你是对的,工件关闭只能向给定的配置添加工件(见
ArtifactHandler API).
你有两个选择:
1)按照here(见第45.6.4.1节“每个项目的多个工件”)添加工件过滤器.如果您使用此方法,请尝试声明存档配置,如:
artifacts {
archives file: file('bin/result.jar'), name: 'result', type: 'jar'
}
这样,你的工件过滤器就像这样:
addFilter('result') {artifact, file ->
artifact.name == 'result'
}
2)将其作为单独的maven模块上传.如果result.jar是您上传的唯一jar,这可能是一个很好的解决方案.
configurations {
resultArchives
}
uploadResultArchives {
repositories {
mavenDeployer {
repository(url: "same/url/here")
}
}
}
artifacts{
resultArchives file: file('bin/result.jar')
}
希望这可以帮助.