环境:
我将在顶层build.gradle上应用jfrog Artifactory插件并进行设置:
clientConfig.info.setBuildName('root')
clientConfig.info.setBuildNumber('root-version'))
此build.gradle文件发布了一个tarball,它是每个子项目中jar的集合。现在,每个子项目还分别在各自的build.gradle脚本中发布其jar。
问题: 我看到两个问题:
build.name和build.number(单击工件-> Properties)与顶层build.gradle文件中的设置相同,即使我覆盖了其中的相应值每个子模块中的artifactoryPublish块。我通过在每个子模块中使用以下代码块来解决名称问题。
apply plugin: 'maven-publish'
apply plugin: "com.jfrog.artifactory"
artifactory {
contextUrl = "${artifactory_url}"
publish {
repository {
repoKey = "snapshot"
username = "username"
password = "pwd"
}
defaults {
publishArtifacts = true
publishBuildInfo = true
publishIvy = false
publishPom = true
}
}
}
publishing {
publications {
gradlePublication(MavenPublication) {
groupId "${rootProject.group}"
artifactId 'sub-project1'
version 'sub-project1-version'
artifact jar
}
}
}
artifactoryPublish {
// workaround otherwise build.name is the top level 'root'
clientConfig.properties['allRootConfig']['artifactory.deploy.build.name'] = 'sub-project1'
clientConfig.info.setBuildName('sub-project1')
properties = [
'build.name': 'sub-project1',
'build.number': 'sub-project1-version'
]
publications (publishing.publications.gradlePublication)
}
“项目名称”(单击工件-> Builds)仍然是“ root”,即使使用(1)中提到的更改后也没有得到修复。这是我现在要解决的问题。
感谢您的帮助。