1
我有一个maven项目,在其中使用maven exec插件执行windows .bat
文件。问题在于,即使蝙蝠执行失败(即退出代码为-1),项目的构建也是SUCCESS。Maven exec插件构建成功,即使可执行文件在Windows上失败
这是我定义的插件:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>run.bat</executable>
</configuration>
</execution>
</executions>
</plugin>
请注意,如果我执行它在Unix如预期一样的行为(即执行sh文件,并生成失败)。
Gerold Broser,感谢您指向noahlz的答案(实际上我已经找到它)不幸的是,用%ERRORLEVEL%退出并没有帮助。所以我遵循noahlz'建议将.bat脚本解构为其实际命令并直接从exec插件启动它。 – vadim