我对buildory
的build-info-extractor gralde插件的问题包含重现问题示例的源代码:https://github.com/lavcraft/gradle-artifactory-build-info-extractor-problems
artifactory_user
artifactory_password
artifactory_contextUrl
./gradlew build aP
我希望,这个例子(见下文)完美无缺
artifactoryPublish {
properties = ['aa':'aaa']
properties {
nebula '**:**:**:*@*', 'not_added_prop':'sub0'
}
}
在github项目中查看sub0 / build.gradle
但它不起作用。我的例子出了什么问题?
答案 0 :(得分:2)
我想我找到了这个问题的原因。 这是在您共享的项目中build.gradle文件中配置的artifactory闭包:
artifactory {
contextUrl = project.findProperty('artifactory_contextUrl')
publish {
repository {
repoKey = 'libs-snapshot-local'
username = project.findProperty('artifactory_user')
password = project.findProperty('artifactory_password')
}
defaults {
publications('nebula')
publishConfigs('archives')
publishIvy = false
properties {
nebula '*:*:*:*@*', 'want_to_add':'but not' // add only to *.pom artifacts. Why?
mavenJava commonProperties, '*:*:*:*@*'
}
}
}
}
如上所示,闭包包括一个出版物(星云)和一个配置(档案)。 运行构建脚本会提示以下部署的工件:
$ gradle clean artifactoryPublish
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/ru/alfalab/platform/tests/sub0/0.1.1-SNAPSHOT/sub0-0.1.1-SNAPSHOT.jar
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/ru/alfalab/platform/tests/sub0/0.1.1-SNAPSHOT/sub0-0.1.1-SNAPSHOT.pom
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/ru/alfalab/platform/tests/sub1/0.1.1-SNAPSHOT/sub1-0.1.1-SNAPSHOT.jar
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/ru/alfalab/platform/tests/sub1/0.1.1-SNAPSHOT/sub1-0.1.1-SNAPSHOT.pom
现在,如果您将出版物注释如下:
//publications('nebula')
publishConfigs('archives')
您可以执行以下操作:
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/ru/alfalab/platform/tests/sub0/0.1.1-SNAPSHOT/sub0-0.1.1-SNAPSHOT.jar
Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/ru/alfalab/platform/tests/sub1/0.1.1-SNAPSHOT/sub1-0.1.1-SNAPSHOT.jar
所以看起来档案配置和星云出版物都贡献了上面相同的两个工件。 由于在“星云”出版物上(而不是在档案出版物上)配置了“want_to_add”属性,因此配置提供的2个罐子不会获得该属性。
对此的一个简单解决方法是删除档案配置:
publications('nebula')
//publishConfigs('archives')
或者,如果由于某种原因您确实希望同时具有配置和发布,则还可以将属性添加到配置中。这是你如何做到这一点:
properties = ['want_to_add': 'but not']
所以完整的闭包,包括两者的发布,配置和属性都是这样的:
defaults {
publications('nebula')
publishConfigs('archives')
publishIvy = false
properties = ['want_to_add': 'but not']
properties {
nebula '*:*:*:*@*', 'want_to_add':'but not' // add only to *.pom artifacts. Why?
mavenJava commonProperties, '*:*:*:*@*'
}
}
您可以在此处详细了解: https://www.jfrog.com/confluence/display/RTF/Gradle+Artifactory+Plugin