当Makefile失败时,如何让execmaven插件失败
我正在使用execmaven插件启动一个(遗留的)Makefile 但是,如果Makefile失败,execmaven插件不会失败,构建将继续并报告成功 maven日志显示以下内容:当Makefile失败时,如何让execmaven插件失败,maven,makefile,Maven,Makefile,我正在使用execmaven插件启动一个(遗留的)Makefile 但是,如果Makefile失败,execmaven插件不会失败,构建将继续并报告成功 maven日志显示以下内容: [INFO] Creating target /src/gateways/src/c++/smtp/smtp-logview/target/bin/logview [INFO] /usr/bin/ld: cannot find -lstlport [INFO] collect2: ld returned 1 exi
[INFO] Creating target /src/gateways/src/c++/smtp/smtp-logview/target/bin/logview
[INFO] /usr/bin/ld: cannot find -lstlport
[INFO] collect2: ld returned 1 exit status
[INFO] logview - 0 error(s), 0 warning(s)
但是,Maven继续,看起来exec Maven插件没有将此视为错误
当Makefile返回此错误时,如何使插件失败
pom配置为:
<!--
Plugin for launching the Makefile to create smtp-logview .a lib
-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>smtp-logview</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>/usr/bin/make</executable>
<workingDirectory>${basedir}/src/main/c++/com/compname/smtp/logview/</workingDirectory>
<arguments>
<argument>--file=logview.mak</argument>
<argument>clean</argument>
<argument>all</argument>
<argument>BASEDIR=${basedir}</argument>
<argument>TECHNOLOGY=${technology-directory}</argument>
<argument>TARGETDIR=${project.build.directory}</argument>
<argument>CS_CUSTOM_BUILD=${basedir}/custom.mak</argument>
<argument>SYS_LIB=${system-lib-directory}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
org.codehaus.mojo
execmaven插件
smtp日志视图
编译
执行官
/usr/bin/make
${basedir}/src/main/c++/com/compname/smtp/logview/
--文件=logview.mak
清洁的
全部的
BASEDIR=${BASEDIR}
技术=${TECHNOLOGY directory}
TARGETDIR=${project.build.directory}
CS_CUSTOM_BUILD=${basedir}/CUSTOM.mak
SYS_LIB=${system LIB directory}
如果ld失败,您将返回正确的返回代码?khmarbaise-谢谢您的建议,我认为您可能是正确的。调用链接器的shell命令返回0/success结果。有没有办法获取链接器退出代码?您可以在make中调用set-e
,这样每个失败的命令都会停止make脚本。有关更多信息,请参阅。我已将问题追溯到一个“set-o pipefail”命令。我删除了-o选项,因为操作系统抱怨一个非法选项;事实证明,如果没有-o选项,“set pipefail”不会传播错误。恢复-o选项将允许传播错误并使Maven失败。为什么操作系统不再抱怨-o是非法选项,目前还不清楚