java - Maven 处理 Nexus 异常

标签 java maven repository nexus

我有一个项目,其中有多个子项目(模块)。更具体地说,这是一个 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 Failuremvn --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/

相关文章:

database - Linq to Sql - 如何使用存储库模式更新对象?

dependency-injection - DDD : is it ok to inject a Repository into an Entity?

java - 根据值动态设置颜色 Java Swing

java - Executors.newFixedThreadPool 中 LinkedBlockingQueue 的好处

java - 如果 Artifact 不在公共(public)存储库中,如何向 Maven 项目提供 Artifact ?

java - 如何删除阴影 .jar 的 module-info.class 警告?

java - 在 JFrame 上使用 KeyListener 来移动组件

java - 使用现有 TextView 设计以编程方式在另一个 TextView 下方显示 TextView

java - 如何获取jar文件的ResourceAsStream

c# - 存储库是否应该确保所有必需的参数都传递到方法中?