title: Run .bat file - Maven/Eclipse
body: <p>I want to run a batch file using maven.</p>
  
  <p>My pom.xml looks like this:</p>
  
  <pre><code>    &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;artifactId&gt;test--clients&lt;/artifactId&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;name&gt;test--clients&lt;/name&gt;
  
  
      &lt;parent&gt;
          &lt;artifactId&gt;test--app&lt;/artifactId&gt;
          &lt;groupId&gt;de.timetoact.test-&lt;/groupId&gt;
          &lt;version&gt;10.0.0&lt;/version&gt;
      &lt;/parent&gt;
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.4&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
  
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.0&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.6&lt;/source&gt;
                      &lt;target&gt;1.6&lt;/target&gt;
                      &lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
      &lt;!-- &lt;properties&gt; --&gt;
      &lt;!-- &lt;maven.compile.source&gt;1.6&lt;/maven.compile.source&gt; --&gt;
      &lt;!-- &lt;maven.compile.target&gt;1.6&lt;/maven.compile.target&gt; --&gt;
      &lt;!-- &lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml&gt; --&gt;
      &lt;!-- &lt;/properties&gt; --&gt;
  
      &lt;dependencies&gt;
  
          &lt;dependency&gt;
          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
          &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
           &lt;version&gt;1.8&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;javax.mail&lt;/groupId&gt;
              &lt;artifactId&gt;mail&lt;/artifactId&gt;
              &lt;version&gt;1.4.7&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.mockito&lt;/groupId&gt;
              &lt;artifactId&gt;mockito-all&lt;/artifactId&gt;
              &lt;version&gt;1.9.5&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax&lt;/groupId&gt;
              &lt;artifactId&gt;javaee-api&lt;/artifactId&gt;
              &lt;version&gt;6.0&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.cloudfoundry&lt;/groupId&gt;
              &lt;artifactId&gt;cloudfoundry-client-lib&lt;/artifactId&gt;
              &lt;version&gt;1.0.2&lt;/version&gt;
          &lt;/dependency&gt;
  &lt;!--        &lt;dependency&gt; --&gt;
  &lt;!--            &lt;groupId&gt;org.springframework.security.oauth&lt;/groupId&gt; --&gt;
  &lt;!--            &lt;artifactId&gt;spring-security-oauth2&lt;/artifactId&gt; --&gt;
  &lt;!--            &lt;version&gt;1.0.0.RELEASE&lt;/version&gt; --&gt;
  &lt;!--            &lt;exclusions&gt; --&gt;
  &lt;!--                &lt;exclusion&gt; --&gt;
  &lt;!--                    &lt;groupId&gt;org.springframework&lt;/groupId&gt; --&gt;
  &lt;!--                    &lt;artifactId&gt;spring-jdbc&lt;/artifactId&gt; --&gt;
  &lt;!--                &lt;/exclusion&gt; --&gt;
  &lt;!--            &lt;/exclusions&gt; --&gt;
  &lt;!--        &lt;/dependency&gt; --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.ibm.sbt&lt;/groupId&gt;
              &lt;artifactId&gt;com.ibm.commons&lt;/artifactId&gt;
              &lt;version&gt;9.0.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;4.8.1&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;commons-fileupload&lt;/groupId&gt;
              &lt;artifactId&gt;commons-fileupload&lt;/artifactId&gt;
              &lt;version&gt;1.3.1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;de.timetoact.test-&lt;/groupId&gt;
              &lt;artifactId&gt;test--util&lt;/artifactId&gt;
              &lt;version&gt;10.0.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;commons-codec&lt;/groupId&gt;
              &lt;artifactId&gt;commons-codec&lt;/artifactId&gt;
              &lt;version&gt;1.9&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
  
      &lt;profiles&gt;
          &lt;profile&gt;
              &lt;id&gt;test--clients-deploy-eu&lt;/id&gt;
              &lt;build&gt;
                  &lt;plugins&gt;
                      &lt;plugin&gt;
                          &lt;groupId&gt;org.cloudfoundry&lt;/groupId&gt;
                          &lt;artifactId&gt;cf-maven-plugin&lt;/artifactId&gt;
                          &lt;version&gt;1.1.2&lt;/version&gt;
                          &lt;configuration&gt;
                              &lt;server&gt;bluemix&lt;/server&gt;
                              &lt;target&gt;https://api.eu-gb.bluemix.net&lt;/target&gt;
                              &lt;org&gt;test-&lt;/org&gt;
                              &lt;space&gt;test--clients-eu&lt;/space&gt;
                              &lt;appname&gt;test--clients&lt;/appname&gt;
                              &lt;urls&gt;
                                  &lt;url&gt;test--clients.eu-gb.mybluemix.net&lt;/url&gt;
                                  &lt;url&gt;test--client.eu-gb.mybluemix.net&lt;/url&gt;
                              &lt;/urls&gt;
  
                              &lt;memory&gt;192&lt;/memory&gt;
                              &lt;services&gt;
                                  &lt;service&gt;
                                      &lt;name&gt;test-&lt;/name&gt;
                                      &lt;label&gt;postgresql&lt;/label&gt;
                                      &lt;plan&gt;100&lt;/plan&gt;
                                  &lt;/service&gt;
                              &lt;/services&gt;
                          &lt;/configuration&gt;
                          &lt;executions&gt;
                              &lt;execution&gt;
                                  &lt;phase&gt;package&lt;/phase&gt;
                                  &lt;goals&gt;
                                      &lt;goal&gt;push&lt;/goal&gt;
                                  &lt;/goals&gt;
                              &lt;/execution&gt;
                          &lt;/executions&gt;
                      &lt;/plugin&gt;
                  &lt;/plugins&gt;
              &lt;/build&gt;
  
          &lt;/profile&gt;
          &lt;profile&gt;
              &lt;id&gt;test--dev-deploy-eu&lt;/id&gt;
              &lt;build&gt;
                  &lt;plugins&gt;
  
      &lt;plugin&gt;
          &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
          &lt;version&gt;1.8&lt;/version&gt;
          &lt;executions&gt;
            &lt;execution&gt;
              &lt;phase&gt;generate-sources&lt;/phase&gt;
              &lt;configuration&gt;
                &lt;tasks&gt;
                  &lt;exec
                    dir="${project.basedir}"
                    executable="${project.basedir}/test.bat"
                    failonerror="true"&gt;
                    &lt;arg line="/c" /&gt;
                  &lt;/exec&gt;
                &lt;/tasks&gt;
              &lt;/configuration&gt;
              &lt;goals&gt;
                &lt;goal&gt;run&lt;/goal&gt;
              &lt;/goals&gt;
            &lt;/execution&gt;
          &lt;/executions&gt;
        &lt;/plugin&gt;
  
  
  
                      &lt;plugin&gt;
                          &lt;groupId&gt;org.cloudfoundry&lt;/groupId&gt;
                          &lt;artifactId&gt;cf-maven-plugin&lt;/artifactId&gt;
                          &lt;version&gt;1.1.2&lt;/version&gt;
                          &lt;configuration&gt;
                              &lt;server&gt;bluemix&lt;/server&gt;
                              &lt;target&gt;https://api.eu-gb.bluemix.net&lt;/target&gt;
                              &lt;org&gt;test-&lt;/org&gt;
                              &lt;space&gt;test--dev-eu&lt;/space&gt;
                              &lt;appname&gt;test--clients&lt;/appname&gt;
                              &lt;urls&gt;
                                  &lt;url&gt;test--clients-dev.eu-gb.mybluemix.net&lt;/url&gt;
                                  &lt;url&gt;test--client-dev.eu-gb.mybluemix.net&lt;/url&gt;
                              &lt;/urls&gt;
  
                              &lt;memory&gt;192&lt;/memory&gt;
                              &lt;services&gt;
                                  &lt;service&gt;
                                      &lt;name&gt;test-&lt;/name&gt;
                                      &lt;label&gt;postgresql&lt;/label&gt;
                                      &lt;plan&gt;100&lt;/plan&gt;
                                  &lt;/service&gt;
                              &lt;/services&gt;
                          &lt;/configuration&gt;
                          &lt;executions&gt;
                              &lt;execution&gt;
                                  &lt;phase&gt;package&lt;/phase&gt;
                                  &lt;goals&gt;
                                      &lt;goal&gt;push&lt;/goal&gt;
                                  &lt;/goals&gt;
                              &lt;/execution&gt;
                          &lt;/executions&gt;
                      &lt;/plugin&gt;
                  &lt;/plugins&gt;
              &lt;/build&gt;
  
          &lt;/profile&gt;
          &lt;profile&gt;
              &lt;id&gt;test--clients-deploy-us&lt;/id&gt;
              &lt;build&gt;
                  &lt;plugins&gt;
                      &lt;plugin&gt;
                          &lt;groupId&gt;org.cloudfoundry&lt;/groupId&gt;
                          &lt;artifactId&gt;cf-maven-plugin&lt;/artifactId&gt;
                          &lt;version&gt;1.1.2&lt;/version&gt;
                          &lt;configuration&gt;
                              &lt;server&gt;bluemix&lt;/server&gt;
                              &lt;target&gt;https://api.ng.bluemix.net&lt;/target&gt;
                              &lt;org&gt;test-&lt;/org&gt;
                              &lt;space&gt;test--clients-us&lt;/space&gt;
                              &lt;appname&gt;test--clients&lt;/appname&gt;
                              &lt;urls&gt;
                                  &lt;url&gt;test--clients.mybluemix.net&lt;/url&gt;
                                  &lt;url&gt;test--client.mybluemix.net&lt;/url&gt;
                              &lt;/urls&gt;
                              &lt;memory&gt;192&lt;/memory&gt;
                              &lt;services&gt;
                                  &lt;service&gt;
                                      &lt;name&gt;test-&lt;/name&gt;
                                      &lt;label&gt;postgresql&lt;/label&gt;
                                      &lt;plan&gt;100&lt;/plan&gt;
                                  &lt;/service&gt;
                              &lt;/services&gt;
                          &lt;/configuration&gt;
                          &lt;executions&gt;
                              &lt;execution&gt;
                                  &lt;phase&gt;package&lt;/phase&gt;
                                  &lt;goals&gt;
                                      &lt;goal&gt;push&lt;/goal&gt;
                                  &lt;/goals&gt;
                              &lt;/execution&gt;
                          &lt;/executions&gt;
                      &lt;/plugin&gt;
                  &lt;/plugins&gt;
              &lt;/build&gt;
  
          &lt;/profile&gt;
      &lt;/profiles&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>What I get as output is:</p>
  
  <pre><code>[INFO] Executing tasks
  [INFO] Executed tasks
  </code></pre>
  
  <p>But the .bat file has not been called.</p>
  
  <p>Tried so much answers here at Stackoverflow I am already despairing.</p>
  
  <p>What is the problem here?</p>