Installing Maven/Gradle
Maven and Gradle are the two most popular build automation tools in the Java ecosystem. They manage dependencies and facilitate various build-related tasks. Here's how to install Maven and Gradle on different operating systems.
Installing Maven
Windows
- 
Download Maven: Visit the official Maven website and download the binary zip archive. 
- 
Extract Zip: Extract the downloaded zip file to a directory of your choice, such as C:\Program Files\Apache\Maven.
- 
Set Environment Variables: - Add a new system variable named M2_HOMEwith the value as the path to your Maven directory.
- Update the PATHsystem variable to include%M2_HOME%\bin.
 
- Add a new system variable named 
macOS/Linux
- 
Download Maven: You can download Maven from the official website or install it via package managers. brew install maven # macOS sudo apt install maven # Ubuntu
- 
Set Environment Variables: Open your .bashrcor.zshrcfile and add the following lines.export M2_HOME=/path/to/maven export PATH=$PATH:$M2_HOME/bin
Installing Gradle
Windows
- 
Download Gradle: Visit the official Gradle website and download the binary zip archive. 
- 
Extract Zip: Extract the downloaded zip file to a directory of your choice, such as C:\Program Files\Gradle.
- 
Set Environment Variables: - Add a new system variable named GRADLE_HOMEwith the value as the path to your Gradle directory.
- Update the PATHsystem variable to include%GRADLE_HOME%\bin.
 
- Add a new system variable named 
macOS/Linux
- 
Download Gradle: You can download Gradle from the official website or install it via package managers. brew install gradle # macOS sudo apt install gradle # Ubuntu
- 
Set Environment Variables: Open your .bashrcor.zshrcfile and add the following lines.export GRADLE_HOME=/path/to/gradle export PATH=$PATH:$GRADLE_HOME/bin
After installation, open a new terminal window and run mvn -v for Maven or gradle -v for Gradle to verify that the tool has been successfully installed.
Book a conversation with us for personalize training today!
