是否可以有条件地将罐子上传到神器?
我尝试过使用Artifactory插件但是如果只是从构建管道上传一个jar就可以正常工作。
如果我还想上传一个测试罐,那怎么回事?
我可以指定哪些jar应该上传的配置吗?例如测试jar或“普通”jar文件
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
artifactory {
clientConfig.setIncludeEnvVars(true)
contextUrl = 'https://localhost:8081/artifactory/'
publish {
repository {
repoKey = 'libs-release-local'
username = "${artifactory_user}"
password = "${artifactory_user_password}"
}
defaults {
publications('mavenJava')
publishArtifacts = true
publishPom = true
publishIvy = true
}
}
resolve {
contextUrl = 'https://localhost:8081/artifactory'
repository {
repoKey = 'libs-release-local'
username = "${artifactory_user"
password = "${artifactory_user_password}"
maven = true
}
}
}
答案 0 :(得分:1)
要从测试SourceSet(默认为src/test/
)发布类,首先需要定义一个任务来创建testJar:
task testJar(type: Jar) {
classifier = 'tests'
from sourceSets.test.output
}
然后将其添加到您的出版物
publications {
mavenJava(MavenPublication) {
from components.java
artifact testJar {
classifier "test"
}
}
}
由于您已从神器中发布publications('mavenJava')
,因此您无需在此处进行任何更改。