Good news: if you're using IntelliJ IDEA, Maven is already bundled. But you still need to install it separately for running commands from the terminal — which is how CI/CD tools like Jenkins run your tests.
Maven needs Java. If you followed the earlier chapters, Java is already installed. Verify with:
java -version
# Should show: java version "17.x.x" or "21.x.x"# Option 1: Using Homebrew (recommended)
brew install maven
# Option 2: Using SDKMAN
sdk install maven
# Verify installation
mvn -version$ mvn -version
Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Maven home: /usr/local/Cellar/maven/3.9.6/libexec
Java version: 17.0.9, vendor: Eclipse Adoptium
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "14.2", arch: "aarch64"If you see the Maven version, Java version, and OS details — you're set. If you get "mvn: command not found" — your PATH is not configured correctly.
The number one installation mistake: not opening a NEW terminal after setting environment variables. Old terminals don't see the change. Close all terminals, open a fresh one, then run mvn -version.
Maven downloads all libraries to your local repository at ~/.m2/repository. This is a hidden folder in your home directory. First time you run a Maven project, it downloads a lot of files. After that, everything is cached locally.
# Windows: check local repo
dir C:\Users\YourName\.m2\repository
# Mac/Linux: check local repo
ls ~/.m2/repository
# This folder will grow to 500MB-1GB over time — that's normalQ: Where does Maven store downloaded dependencies?
A: Maven stores all downloaded dependencies in the local repository at ~/.m2/repository. When you add a dependency in pom.xml, Maven first checks this local cache. If the JAR is already there, it uses the cached version. If not, it downloads from Maven Central and stores it locally. This means the first build takes longer, but subsequent builds are faster because dependencies are already cached.
Key Point: Install Maven, verify with mvn -version, and know that all JARs live in ~/.m2/repository.