title: exec-maven-plugin says cannot run specified program, even though it is on the PATH
body: <p><em>Edit 20140716</em>:</p>
  
  <p><a href="https://stackoverflow.com/a/22395703/194982">Solution found</a></p>
  
  <p>tl;dr = exec-maven-plugin does <strong>not</strong> recognise <code>.cmd</code> files, but only <code>.bat</code> files, as executable scripts. Rename <code>grunt.cmd --&gt; grunt.bat</code>, <code>bower.cmd --&gt; bower.bat</code>, etc. as a workaround.</p>
  
  <hr>
  
  <p>Having done <code>npm install -g grunt-cli</code> on my system, <code>grunt</code> is most certainly on the <code>PATH</code></p>
  
  <p>When I run <code>maven install</code> however, this doesn't seem to register.</p>
  
  <pre><code>    [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec 
      (build-spa-bower) on project foobar: Command execution failed. 
      Cannot run program "grunt" (in directory "C:\workspace\foobar\src\main\spa"): 
      CreateProcess error=2, The system cannot find the file specified -&gt; [Help 1]
      org.apache.maven.lifecycle.LifecycleExecutionException: 
      Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec 
      (build-spa-bower) on project foobar: Command execution failed.
  </code></pre>
  
  <p>Just to be sure, in the same terminal, I have executed this</p>
  
  <pre><code>cd C:\workspace\foobar\src\main\spa
  grunt build
  </code></pre>
  
  <p>... in the same terminal as I issued the maven command above, and grunt executes just fine.</p>
  
  <p>Does <code>exec-maven-plugin</code> use the <code>PATH</code> environment variable, or does it need to be told that this executable exisst in some other way?</p>
  
  <hr>
  
  EDIT:
  
  <p>This <a href="http://www.mojohaus.org/exec-maven-plugin/exec-mojo.html#executable" rel="nofollow noreferrer">documentation</a> suggests that executables on <code>PATH</code> should be found, so it stumps me further.</p>