我有一个项目,其中有多个子项目(模块)。更具体地说,这是一个 Eclipse 项目,具有多种功能。
问题是某个版本的功能可能不需要任何更改。因此,我不会提高版本号,但同一项目中的另一个功能可能会发生变化。由于重新部署相同版本被认为是不好的做法,因此我在 Nexus 中禁用了该选项。
现在,实际问题发生在我部署时。因此,部署任何具有新版本号的东西都可以正常工作,但是当部署旧版本时,我有点期待 Maven 发出警告,警告它已经存在于存储库中,然后跳过它,但事实证明 Nexus 响应:
Return code is: 400, ReasonPhrase:Bad Request.
这会导致 Maven 整个部署过程失败。完整的错误是:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project xyz: Failed to deploy artifacts: Could not transfer artifact xyz:target:2.5.8.0 from/to nexus (http://host/nexus/content/repositories/releases): Failed to transfer file: http://host/nexus/content/repositories/releases/x/targets/xyz/2.5.8.0/xyz-2.5.8.0.target. Return code is: 400, ReasonPhrase:Bad Request. -> [Help 1]
build 11-Sep-2015 07:09:57 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project abc: Failed to deploy artifacts: Could not transfer artifact foo:abc:jar:2.5.8.0 from/to nexus (http://host/nexus/content/repositories/releases): Failed to transfer file: http://host/nexus/content/repositories/releases/bar/abc/2.5.8.0/abc.ocl-2.5.8.0.jar. Return code is: 400, ReasonPhrase:Bad Request. -> [Help 1]
问题是,我该如何处理这个失败/异常?我想要的只是如果它已经部署,然后跳过/忽略该 Artifact 的部署。
最佳答案
参见Maven: The Complete Reference, 6.1. Maven Command Line Options, 6.1.8. Dealing with Failure或mvn --help
:
-fae,--fail-at-end Only fail the build afterwards;
allow all non-impacted builds to
continue
关于java - Maven 处理 Nexus 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32511972/