title: exec maven plugin: exit code
body: <p>I am having the following plugin to run a <code>.sh</code> script:</p>
  
  <pre><code>&lt;plugin&gt;
    &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
    &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
    &lt;executions&gt;
      &lt;execution&gt;
        &lt;id&gt;deploy-bundles&lt;/id&gt;
        &lt;phase&gt;install&lt;/phase&gt;
        &lt;goals&gt;
          &lt;goal&gt;exec&lt;/goal&gt;
        &lt;/goals&gt;
        &lt;configuration&gt;
          &lt;executable&gt;${basedir}/deploy.sh&lt;/executable&gt;
          &lt;successCodes&gt;
              &lt;successCode&gt;0&lt;/successCode&gt; &lt;-- Not working
          &lt;/successCodes&gt;
        &lt;/configuration&gt;
      &lt;/execution&gt;
    &lt;/executions&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>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 <code>set -e</code> command in my <code>.sh</code> script, but I want a maven solution too. I heard that there is a <a href="http://www.mojohaus.org/exec-maven-plugin/exec-mojo.html#successCodes" rel="nofollow">tag</a> called <code>successCodes</code>, I try to incorporate it. But no luck so far. Could someone point out the correct way of doing it?</p>
  
  <p><strong>Edit:</strong> My <code>.sh</code> script looks like this:</p>
  
  <pre><code>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  
  </code></pre>
  
  <p>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 <code>set -e</code> command in the <code>.sh</code> script), however maven reports is as "success".</p>