Java Maven Installation

Installing Maven for Java on macOS Here’s a step-by-step guide to install Apache Maven for Java development on macOS: Prerequisites Java JDK (Maven requires Java to run) 1. First, check if Java is installed 1java -version If Java isn’t installed, install it first (JDK 8 or later recommended). You can get it from: Oracle JDK Or use Homebrew: brew install openjdk Installation Methods Method 1: Using Homebrew (recommended) 1# Update Homebrew 2brew update 3 4# Install Maven 5brew install maven 6 7# Verify installation 8mvn -v Method 2: Manual Installation Download Maven from the official website Extract the archive to your desired location (e.g., /usr/local/apache-maven) Configure environment variables: 1# Edit your shell configuration file (~/.zshrc or ~/.bash_profile) 2nano ~/.zshrc # or ~/.bash_profile for older macOS versions 3 4# Add these lines (adjust path if needed): 5export M2_HOME=/usr/local/apache-maven/apache-maven-3.8.6 6export PATH=$M2_HOME/bin:$PATH 7 8# Save and reload 9source ~/.zshrc # or source ~/.bash_profile Verify Installation 1mvn -version You should see output similar to: ...

June 9, 2025 · 2 min · 215 words · xxraincandyxx