美文网首页
Gradle构建后发布到私有仓库

Gradle构建后发布到私有仓库

作者: Rickywu1113 | 来源:发表于2018-12-04 16:31 被阅读0次
    buildscript {
        ext {
            springBootVersion = '2.0.0.RELEASE'
        }
        repositories {
              maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
        }
        dependencies {
            classpath("com.bmuschko:gradle-nexus-plugin:2.3.1")
            classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
        }
    }
    
    apply plugin: 'java'
    apply plugin: 'com.bmuschko.nexus'
    apply plugin: 'org.springframework.boot'
    apply plugin: 'io.spring.dependency-management'
    
    def repo = 'http://nexus/repository'
    group = 'com.company.package'
    version = '1.0.0-SNAPSHOT'
    description = "company-package"
    
    sourceCompatibility = 1.8
    targetCompatibility = 1.8
    
    tasks.withType(JavaCompile) {
        options.encoding = 'UTF-8'
    }
    
    tasks.withType(Jar) {
        destinationDir = file("$rootDir/build")
    }
    
    repositories {
         maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
    }
    
    ext {
        springCloudVersion = 'Finchley.RELEASE'
    }
    
    dependencies {
        ...
    }
    
    dependencyManagement {
        imports {
            mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
        }
    }
    
    test {
        exclude '**/*'
    }
    
    jar {
        enabled = true
    }
    
    bootJar {
        enabled = false
    }
    
    extraArchive {
        sources = false
        tests = false
        javadoc = false
    }
    
    nexus {
        sign = true
        repositoryUrl = "${repo}/maven-releases/"
        snapshotRepositoryUrl = "${repo}/maven-snapshots/"
    }
    

    nexus登录信息需要在~/.gradle/gradle.properties中配置好
    nexusUsername = admin
    nexusPassword = admin123

    相关文章

      网友评论

          本文标题:Gradle构建后发布到私有仓库

          本文链接:https://www.haomeiwen.com/subject/jdcvcqtx.html