java - mvn 任务失败时如何使 Ant 构建失败?

标签 java maven ant build maven-ant-tasks

我有一个 Ant 构建,它使用“artifact:mvn ...”调用 mvn 任务,如 http://maven.apache.org/ant-tasks/examples/mvn.html 中所述。 .

问题是,即使这些内部 mvn 构建之一以失败告终,我的整个 Ant 构建最终仍会报告 BUILD SUCCESSFUL。

当至少一个 mvn 任务失败时,如何让我的 Ant 构建报告构建失败?

最佳答案

The mvn task is a subclass of the Ant java task and supports all of its options

任务可能会立即失败,并显示 failonerror="true"或者您可以验证 resultproperty稍后。

By default the return code of a <java> is ignored. Alternatively, you can set resultproperty to the name of a property and have it assigned to the result code (barring immutability, of course). When you set failonerror="true", the only possible value for resultproperty is 0. Any non-zero response is treated as an error and would mean the build exits.

关于java - mvn 任务失败时如何使 Ant 构建失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28245558/

相关文章:

java - 如果在我的 for 循环中相同的对象在所有迭代中都被初始化,会发生什么?

Eclipse m2e多模块项目 checkout 并转换为maven

java - 使用 Maven 运行 mvn package 找不到目标 'single'

ant - 有没有更简单的方法来部署到WebSphere?

java - 如何在 NetBeans 6.9 中构建 jar?

java - 与 PayPal 的 OkHTTP 连接出现 SSLHandshakeException

java - 将十六进制字符串转换为 IP 地址

java - 使用 Ant 构建 Android 应用程序时遇到错误

java - 如何在没有客户端提示的情况下接收从服务器到客户端的消息

maven - 客户端管理员的 Apache Kafka Maven 包名称