How to send Artifactory publish credentials from b

2019-07-20 19:49发布

Take this snippet from a Gradle build for instance:

repository {
   repoKey = 'libs-snapshot-local'
   username = 'whatever'
   password = 'whatever123'
}

In the past, I've configured Maven (some setting under ~/.m2) to simply pass username/password along. If at all humanly possible I'd like to avoid putting my login credentials for our Artifactory server inside a buildscript. Is there a more secure workaround?

1条回答
时光不老,我们不散
2楼-- · 2019-07-20 20:32

you can put a gradle.propertiesfile into your ~/.gradle/ folder.

In this file you can put your credentials:

artifactoryUserName = whatever
artifactoryUserPassword = whatever123

now you can reference these properties in your build script:

repository {
    repoKey = 'libs-snapshot-local'
    username = project.hasProperty('artifactoryUserName') ? artifactoryUserName : ''
    password = project.hasProperty('artifactoryUserPassword') ? artifactoryUserPassword : ''
}
查看更多
登录 后发表回答