I am having the following plugin to run a .sh
script:
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution>
<id>deploy-bundles</id>
<phase>install</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${basedir}/deploy.sh</executable>
<successCodes>
<successCode>0</successCode> <-- Not working
</successCodes>
</configuration>
</execution>
</executions>
</plugin>
which copies some folders and files to certain locations. It works. However, just in case, I want to have a fail-on-error mechanism. I already have set -e
command in my .sh
script, but I want a maven solution too. I heard that there is a tag called successCodes
, I try to incorporate it. But no luck so far. Could someone point out the correct way of doing it?
Edit: My .sh
script looks like this:
cp ../template/config.properties $component/conf
cp ../../runtime/group1/group1.mw/conf/log4j.xml $component/conf
# if the component is planning, create an additional folder called plans
if [[ $component == *".planning"* ]]
then
mkdir -p $component/plans
# copy all the plans here
cp ../../mission.planning/plans/* $component/plans
fi
where it is expected to fail in case these folders/files are not there. So, as a test, I manually change the paths above and expect it to fail. It does fail the execution process and tells me the error (since I have set -e
command in the .sh
script), however maven reports is as "success".