问题描述
repository {
repoKey ='libs-snapshot-本地'
用户名='无论'
密码='whatever123'
}
过去,我已经配置了Maven(在〜/ .m2
下的一些设置)来简单地传递用户名/密码。如果可能的话,我想避免将我们的Artifactory服务器的登录凭证放入build脚本中。是否有更安全的解决方法?
您可以将 gradle.properties
文件放入你的〜/ .gradle /文件夹中。
在这个文件中你可以放入你的凭证:
artifactoryUserName =任何
artifactoryUserPassword = whatever123
现在您可以在您的构建脚本中引用这些属性:
repository {
repoKey ='libs-snapshot-local'
username = project.hasProperty('artifactoryUserName')? artifactoryUserName:''
password = project.hasProperty('artifactoryUserPassword')? artifactoryUserPassword:''
}
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?
you can put a gradle.properties
file 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 : ''
}
这篇关于如何发送Artifactory发布来自buildscript的凭证而不需要对其进行硬编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!