how to detect a build error from ant/maven via a bash script?

后端 未结 6 1197
南笙
南笙 2020-12-29 01:38

I am writing a bash script to automate the build process. There are two major build blocks, one is an ant task and one is a plain old mvn clean install. I want

6条回答
  •  粉色の甜心
    2020-12-29 01:58

    There are a few issues against Maven 2 returning incorrect return codes (i.e. always returning 0). Notably MNG-3651 that was fixed in Maven 2.0.9.

    In older versions, mvn.bat ended with this line:

    exit /B %ERROR_CODE%
    

    From Maven 2.0.9 onwards, the last line was changed to this:

    cmd /C exit /B %ERROR_CODE%
    

    So a non-0 return code is returned if the build fails. In the case of a build ERROR the return code is 1. If you are unable to upgrade to 2.0.9+, you could consider modifying mvn.bat as above to return the correct code.

提交回复
热议问题