17
votes

While trying to build a Java project under NetBeans (with an external Maven configured), I got the following error:

"C:\Users......\bin\mvn.bat"" is not recognized as an internal or external command, operable program or batch file"

Edit: Using Maven 3.3.3, Windows 10; Added custom maven to NetBeans under Tools > Options > Java > Maven > Execution > Maven Home > Browse

What can I do?

3
This question is lacking a lot of data. What's the version of Maven you're using? What operating system are you using? How did you configure the external Maven in NetBeans?Daniel Pryden
Looks like a quotes issue in the path specification for mvn.bat; how exactly is the path given?aschipfl
thanks for the help but meanwhile I solved it: please checkout my answer bellow. regarding the path, it is given by the browse... prntscr.com/8j5w5mLuís Soares

3 Answers

43
votes

To solve it:

  1. Go to the Maven installation folder
  2. Go to bin
  3. Make sure you can see file extensions
  4. Duplicate mvn.cmd and mvnDebug.cmd and rename those copies to have the extension .bat
  5. Try building the project now

source

2
votes

Install Netbeans 8.1 or later to correct this issue.

As @mkleint noted, this is a problem with Maven 3.3.3+ where maven changed the mvn executable extension.You can download the latest version on the Netbeans website.

1
votes

Maven 3.3+ has no more mvn.bat you should use version 2.5.2+ of the maven-release-plugin : https://issues.apache.org/jira/browse/MRELEASE-902