Jenkins发布jar包到nexus私服报Return code 400 ReasonPhrase Bad Request

问题描述

开发通过jenkins发布jar包到nexus私服,报如下错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy (default-deploy) on project typhon: ArtifactDeployerException: Failed to deploy artifacts: Could not transfer artifact cn.bjca.footstone:typhon:pom:1.0.1 from/to releases (http://example.nexus.com/repository/releases/): Failed to transfer file: http://example.nexus.com/repository/releases/cn/bjca/footstone/typhon/1.0.1/typhon-1.0.1.pom. Return code is: 400, ReasonPhrase: Bad Request. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy (default-deploy) on project typhon: ArtifactDeployerException

问题定位及解决

  1. 首先排查了代码的pom文件,检查pom文件中的distributionManagement部分的配置,检查发现配置正确。
 <distributionManagement>
        <repository>
            <id>releases</id>
            <name>Nexus Release Repository</name>
            <url>${nexusReleaseUrl}</url>
        </repository>
        <snapshotRepository>
            <id>snapshots</id>
            <name>Nexus Snapshot Repository</name>
            <url>${nexusSnapshotUrl}</url>
        </snapshotRepository>
</distributionManagement>
  1. 然后查看编译结果,这里发现有些问题,父pom文件中定义了软件版本为1.0.1,但是子模块中又分别定义了子模块的版本为1.0.0, 同时检查nexus私服,发现私服上已经有了版本为1.0.0的jar包,所以,让开发回去重新梳理pom文件中的模块的版本号。
  2. 开发修改版本号后再次提交代码,发现报同样的错误。 检查nexus私服,发现父pom已经上传私服,删除私服上的父pom文件,再次上传。
  3. 上传仍然失败。
  4. 重新逐一检查打包的版本信息,没有问题。但是一运行deploy就报错。于是回头检查releases的配置,发现有个配置可能有影响:
  5. 在这里插入图片描述
  6. 尝试将disable redeploy改成了Allow redeploy, 然后运行job重新上传,可以上传。问题解决。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值