我有一个 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/