用maven desploy命令时,提示失败,不能把本地 jar 上传到私服仓库中,报错信息如下
Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project 项目名: Failed to deploy artifacts: Could not transfer artifact jar包名称:1.1.0-RELEASE from/to test (http://私服地址/repository/maven-releases/): Failed to transfer file xxxxxwith status code 400
原因:宿主仓库不允许重复部署
默认情况下重复部署构件到 Releases 仓库中也会出现 400 错误,原因是 Nexus 私服中 Releases 仓库默认的 Deployment Policy 是 “Disable Redeploy”,所以当你重复部署构件至 Releases 宿主仓库时就会出现这个 400 错误。出现这个问题,只需要将宿主仓库的 Deployment Policy 改为 “Allow Redeploy ” 即可解决,解决方法如下所示:
方案二:
更改本地 jar 包版本号,只要和私服已经存在的版本号不一样即可。