Gradle 打包上传至私有仓库配置

 

allprojects{
    apply plugin: 'java'
    apply plugin: 'idea'
    apply plugin: 'maven'
    group 'com.xxxxx.base'
    sourceCompatibility = 1.8
    ext{
        mavenUrl = "http://maven.xxxxx.com/nexus/content/groups/public/"

        mavenThirdparty = "http://maven.xxxx.com/nexus/content/repositories/thirdparty"
        mavenSnapshot = "http://maven.xxxx.com/nexus/content/repositories/Snapshot"
        mavenThirdpartyUserName = "admin"
        mavenThirdpartyPwd = "xxxxx"
        mavenSnapshotUserName = "uploader"
        mavenSnapshotPwd = "uploader"
        
        packLogbackVersion = "0.0.1"
    }
    repositories {
        maven {
            url "${mavenUrl}"
        }
    }
}

//上传到nexus
uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: "${mavenThirdparty}") {
                authentication(userName: "${mavenThirdpartyUserName}", password: "${mavenThirdpartyPwd}")
            }
            snapshotRepository(url: "${mavenSnapshot}") {
                authentication(userName: "${mavenSnapshotUserName}", password: "${mavenSnapshotPwd}")
            }
            println "$version"
            pom.version = "$version"
            pom.artifactId = "$archivesBaseName"
            pom.groupId = "$project.group"
        }
    }
}

 

posted @ 2019-04-25 10:13  bookc  阅读(2631)  评论(0编辑  收藏  举报