We use cookies to analyze site traffic and show personalized ads. You can accept all cookies or decline personalized advertising.
Learn more in our Privacy Policy.
Download and configure Apache Maven for Java project management.
mvn -version.Maven is the standard build and dependency management tool for Java projects. Tools like Selenium test frameworks, Spring Boot apps, and CI pipelines often depend on Maven.
If Maven (or MAVEN_HOME) is misconfigured, you will face issues like:
mvn is not recognized as an internal or external commandGetting Maven installed correctly once saves a lot of debugging time later. (maven.apache.org)
Before starting, make sure you have:
pom.xml file to define dependencies, plugins, and build steps. (maven.apache.org)C:\Tools\apache-maven-3.9.11%MAVEN_HOME%\bin to Path lets you run mvn from any terminal.apache-maven-3.9.11-bin.zip). (maven.apache.org)apache-maven-3.9.11-bin.zip(The exact version number may be newer; always pick the latest.)
Maven doesn’t have an installer. You just extract the zip.
C:\Users\<YourUser>\Downloads\apache-maven-3.9.11-bin.zipC:\Tools\apache-maven-3.9.11C:\Tools\apache-maven-3.9.11, to avoid issues with some scripts and older tools. (Mkyong.com)C:\Tools\apache-maven-3.9.11MAVEN_HOME.C:\DevTools or C:\Tools. It makes backups, upgrades, and documentation easier.MAVEN_HOMEC:\Tools\apache-maven-3.9.11MAVEN_HOME points to the root Maven folder, not the bin folder.C:\Tools\apache-maven-3.9.11C:\Tools\apache-maven-3.9.11\binmvn Works Everywhere)%MAVEN_HOME%\binNow, every new terminal window will know where mvn.exe lives. (phoenixNAP)
Path entries. Just add a new line for %MAVEN_HOME%\bin so you don’t break other tools.cmd) window.echo %MAVEN_HOME%You should see your Maven directory printed, for example:
C:\Tools\apache-maven-3.9.11mvn -versionYou should see an output similar to:
Apache Maven 3.9.11 (…)
Maven home: C:\Tools\apache-maven-3.9.11
Java version: 21.0.x, vendor: Oracle Corporation
OS name: "Windows 11", version: "10.0", arch: "amd64", family: "windows"mvn -version works, Maven is ready to use for any project on your machine.Here are the exact commands you’ll use to validate your setup on Windows:
:: Check MAVEN_HOME
echo %MAVEN_HOME%
:: Check Maven version and Java integration
mvn -versionecho %MAVEN_HOME%mvn -versionPathIf either command fails, you know exactly which part of the configuration is broken.
C:\Tools or C:\DevTools to keep paths clean and predictable.JAVA_HOME or MAVEN_HOME, restart IntelliJ / VS Code so they pick up the new environment variables....apache-maven-3.9.11\bin instead of ...apache-maven-3.9.11.JAVA_HOME is wrong, mvn -version will fail. (maven.apache.org)%MAVEN_HOME%\bin; don’t delete existing entries.