title: Maven not recognized in Jenkins
body: <p>I have installed Tomcat 7 on Windows 8, on which Jenkins is deployed. I configured the JDK, Ant and Maven in the Jenkin settings. In the Maven section, I gave a name as LocalMaven and the MAVEN_HOME as <code>C:\Techie\apache-maven</code>. When I did a test build, it gave me the following error that the mvn.bat is not recognized. Then I checked by entering mvn command in CMD. It gave some maven statements, which means maven is available in the <code>PATH</code> variables. </p>
  
  <p>After googling, I changed the MAVEN_HOME as <code>**%M2_HOME%\bin**</code> in Jenkin-Maven configuration. Still it did not work. </p>
  
  <p><strong>LOG:</strong></p>
  
  <ul>
  <li><p><code>[workspace] $ cmd.exe /C '"mvn.bat -f HighScoresServiceClient compile &amp;&amp; exit %%ERRORLEVEL%%"'</code></p></li>
  <li><p>'<code>mvn.bat</code>' is not recognized as an internal or external command,
  operable program or batch file</p></li>
  <li><p>Build step '<code>Invoke top-level Maven targets</code>' marked build as failure</p></li>
  <li><p>Finished: <code>FAILURE</code></p></li>
  </ul>
  
  <p><strong>Edited: Added the analysis</strong></p>
  
  <p>The command executed by Jenkins is <code>[workspace] $ cmd.exe /C '"mvn.bat -f String-replacer compile &amp;&amp; exit %%ERRORLEVEL%%"'</code> where mvn.bat is not a valid command and so Jenkins errors out as follows that <code>'mvn.bat' is not recognized as an internal or external command,</code> I think Jenkins should call the command as mvn and not mvn.bat. Can some experts correct me if I am wrong? Please let me know how to change this behaviour if I am right.</p>
  
  <p><strong>Edited: Attached the Configuration</strong>
  <img src="https://i.stack.imgur.com/Y0qex.jpg" alt="Maven-JDK-Git Configuration in Jenkins"></p>
  
  <p><img src="https://i.stack.imgur.com/LUfgF.jpg" alt="Maven is available in the PATH variables"></p>