0
在Maven中有settings.xml
文件,我在其中配置存储库(如Sonatype Nexus服务器上的Maven存储库)。Gradle中的最佳实践是全局配置Maven存储库
在我的Gradle项目中,Maven存储库的URL直接在我的build.gradle
文件中配置。
Gradle中的全局配置存储库和构建文件外的最佳实践是什么?
在Maven中有settings.xml
文件,我在其中配置存储库(如Sonatype Nexus服务器上的Maven存储库)。Gradle中的最佳实践是全局配置Maven存储库
在我的Gradle项目中,Maven存储库的URL直接在我的build.gradle
文件中配置。
Gradle中的全局配置存储库和构建文件外的最佳实践是什么?
我把%GRADLE_USER_HOME%/gradle.properties
nexus.user=somecoolguy
nexus.password=guessme
下然后我用这个片段
allprojects {
repositories {
def repoUrls = [
'https://mynexus:8081/nexus/content/groups/foo',
'https://mynexus:8081/nexus/content/groups/bar',
'https://mynexus:8081/nexus/content/groups/baz'
}
repoUrls.each { String repoUrl ->
maven {
url repoUrl
credentials {
username project.properties['nexus.user']
password project.properties['nexus.password']
}
}
}
}
}
你可以easliy转段为custom plugin,也许它提高到
project.hasProperty('nexus.user')
返回false时失败