gradle如何配置maven私服的认证

之前是这样的:

repositories {
    maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
}

更改后是这样的:

repositories {
    maven {
        credentials {
        username 'username'
        password 'password'
        }
    url 'http://maven.coder4.com/nexus/content/groups/public' }
}

更进一步,我们肯定不希望提交代码的时候暴露我们自己的密码,可以这样搞:

cat ~/.gradle/gradle.properties
mavenUser=username
mavenPass=password
repositories {
        maven {
            credentials {
                username "$mavenUser"
                password "$mavenPass"
            }
            url 'http://maven.coder4.com/nexus/content/groups/public'
        }
    }

 

 

 

Leave a Reply

Your email address will not be published.