gpt4 book ai didi

plugins - 使用Gradle将不同的 jar 上传到Artifactory

转载 作者:行者123 更新时间:2023-12-03 04:02:11 26 4
gpt4 key购买 nike

是否可以有条件地将 jar 上传到 Artifact ?

我曾尝试使用Artifactory插件,但如果只是从构建管道上传单个jar的情况下,效果很好。

如果我还想上传一个测试 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
}
}
}

最佳答案

要从您的测试SourceSet(默认为src/test/)发布类,您首先需要定义一个任务来创建testJar:

task testJar(type: Jar) {
classifier = 'tests'
from sourceSets.test.output
}

然后将其添加到您的出版物中
publications {
mavenJava(MavenPublication) {
from components.java

artifact testJar {
classifier "test"
}
}
}

由于您已经从 Artifact 发布了 publications('mavenJava'),因此无需在此处进行任何更改。

关于plugins - 使用Gradle将不同的 jar 上传到Artifactory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36413571/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com