How to Install Maven on Windows
Install Maven on Windows so you can build pom.xml projects, resolve dependencies, and run Maven commands from any terminal.
Supported Versions
Official Source
Apache (official)
Environment Setup
2 environment variables + 1 PATH entry
Verify Step
mvn -version
DevTools Installer is not affiliated with, endorsed by, or sponsored by the publisher of Apache Maven. All product names and logos are trademarks of their respective owners. Downloads are sourced directly from the official publisher.
Install With DevTools Installer
Use this path if you want DevTools Installer to download the official package and handle the Windows setup for you.
- 1Open DevTools Installer.
- 2In Package Managers, select "Apache Maven".
- 3Click "Install Selected".
- 4Let the installer download the official zip, extract it, set MAVEN_HOME and M2_HOME, and add to PATH.
- 5Open a new terminal window after the install finishes.
- 6Run to confirm Maven can find your JDK and start correctly.
Download Source
DevTools Installer downloads from the official publisher:
https://dlcdn.apache.org/maven/maven-3/3.9.14/binaries/apache-maven-3.9.14-bin.zip
PATH & Environment Variables
DevTools Installer sets the following automatically:
Environment variables
MAVEN_HOME=C:\Program Files\Maven\apache-maven-3.9.14
M2_HOME=C:\Program Files\Maven\apache-maven-3.9.14
PATH entries
%MAVEN_HOME%\bin
Verification
DevTools Installer verifies the install by running:
mvn -version
Expected output: Apache Maven 3.9.14
Manual Installation Steps
Use these steps if you want to run the installer yourself and apply the Windows PATH or environment changes manually.
- 1Install a JDK first. Maven will not start without JAVA_HOME pointing to a JDK.
- 2Download the official zip from https://dlcdn.apache.org/maven/maven-3/3.9.14/binaries/apache-maven-3.9.14-bin.zip
- 3Extract the archive to .
- 4Set MAVEN_HOME to .
- 5Set M2_HOME to the same directory, then add to PATH.
- 6Open a new terminal and run .
Need to upgrade, downgrade, or remove Apache Maven?
DevTools Installer can also upgrade Apache Maven to a newer version, roll back to an older one, or cleanly uninstall it — including PATH entries and environment variables. No manual cleanup required.
What Is Apache Maven Used For?
- Building and packaging Java applications as JAR or WAR files.
- Managing project dependencies — Maven downloads libraries from Maven Central automatically.
- Standardizing project structure across teams using the Maven conventions.
- Running unit and integration tests as part of a build lifecycle.
- Generating project documentation, code-quality reports, and dependency trees.
Common Issues And Fixes
Check the problem and the exact fix before you reinstall anything. Some guides also include the reason the issue happens.
Problem
"mvn" is not recognized as a command
Exact fix
Verify MAVEN_HOME is set and %MAVEN_HOME%\bin is in your PATH. Open a new terminal — existing sessions do not see PATH changes.
Problem
Maven says "JAVA_HOME is not set" or uses the wrong Java version
Exact fix
Maven requires a JDK, not just a JRE. Set JAVA_HOME to your JDK directory (e.g., C:\Program Files\Java\jdk-21.0.10) and ensure it does not point to a JRE subfolder.
Problem
Dependency downloads fail or are very slow
Exact fix
Check your internet connection and any corporate proxy settings. Add proxy configuration to your Maven settings.xml file at %USERPROFILE%\.m2\settings.xml if behind a firewall.
Problem
Build fails with "Could not find artifact" errors
Exact fix
The dependency may not exist in Maven Central. Verify the groupId, artifactId, and version in your pom.xml. If it is a private artifact, configure a repository mirror in settings.xml.
Tips for Apache Maven
- ✓Maven requires a JDK to be installed first. Install Java via DevTools Installer before installing Maven.
- ✓The local repository cache is stored at %USERPROFILE%\.m2\repository. Delete it if you suspect corrupted downloads.
- ✓Use "mvn clean install -DskipTests" during development for faster builds. Run tests separately with "mvn test".
- ✓For multi-module projects, run "mvn install" from the root to build all modules in dependency order.
Related Guides
Java (JDK)
Install a JDK on Windows so Java apps, build tools, Android Studio, and IDEs can find java, javac, and JAVA_HOME.
Gradle
Install Gradle on Windows so you can run gradle commands, create new builds, and work on projects that do not already ship with the Gradle Wrapper.
IntelliJ IDEA
Install IntelliJ IDEA on Windows if you want a full Java and Kotlin IDE with built-in Maven, Gradle, testing, and debugging support.