【发布时间】:2018-11-29 18:13:25
【问题描述】:
我正在尝试使用 Nexus Jenkins 插件上传带有 pom 文件的发布工件。
Nexus 存储库配置了“禁用重新部署”的部署策略,因此无法覆盖发布。
为了简化问题,假设我只想上传我的自定义 pom:
pipeline {
agent any
stages {
stage('Publish') {
steps {
nexusPublisher nexusInstanceId: 'nexusJose', nexusRepositoryId: 'nexusJose',
packages: [
[$class: 'MavenPackage',
mavenAssetList: [
[classifier: '',
extension: 'pom',
filePath: "/libs/mylib-4.6.0.pom"],
],
mavenCoordinate: [
artifactId: "mylib",
groupId: "com.codependent.libs",
packaging: "pom", version: "4.6.0"]
]
]
}
}
}
}
由于某些原因,当 nexusPublisher 执行时,Nexus 在执行 pom 上传之前为这些坐标创建一个默认 pom,因此实际 pom 的上传失败,因为它已经存在于存储库中:
Uploading Maven asset with groupId: mylib artifactId: com.codependent.libs version: 4.6.0 To repository: thirdparty
Upload of /libs/mylib-4.6.0.pom failed
Failing build due to failure to upload file to Nexus Repository Manager Publisher
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
com.sonatype.nexus.api.exception.RepositoryManagerException: Unable to upload component: Bad Request <html><body><error>Repository with ID='thirdparty' does not allow updating artifacts.</error></body></html>
如何使用自己的 pom 上传工件?
【问题讨论】:
标签: jenkins jenkins-plugins jenkins-pipeline nexus