Printing and PDF export are disabled for this content. View it online at Full Stack Learning Simplified.
Install Maven
Maven needs a JDK first (it runs on Java). Then install Maven itself, or β better β use the wrapper that most projects ship with.
Install & verify
bash
# macOS (Homebrew)
brew install maven
# then check:
mvn -versionmvn -version prints the Maven version *and* the Java version it's using β confirm both are what you expect.
JAVA_HOME
Maven uses JAVA_HOME to find the JDK. If mvn -version shows the wrong Java, set it.
bash
export JAVA_HOME=/path/to/jdk-21The Maven Wrapper (preferred)
Most projects include mvnw/mvnw.cmd β the Maven Wrapper. It downloads and runs the exact Maven version the project needs, so everyone (and CI) builds identically, with no global install.
bash
./mvnw -version # macOS/Linux
mvnw.cmd -version # WindowsThe .m2 folder
Maven stores its local cache and optional settings in a .m2 folder in your home directory: ~/.m2/repository (downloaded libraries) and ~/.m2/settings.xml (optional config, covered later).
Tip: Prefer
./mvnw over a globally installed mvn in real projects β it guarantees the whole team uses the same Maven version.Free preview. Sign in and subscribe to unlock all 809 lessons across 25 courses.
Free preview Β· Β© 2026 Full Stack Learning Simplified