How to Install Maven?
A maven is a tool that is used to build and manage any Java-based project. It makes it easier to maintain the project, to publish project information and to share JARs across several projects. In addition to all this, Maven is an open source tool.
Following are a few key features of Maven:
- Simple project setup
- A large and growing repository of libraries and metadata
- Ability to easily work on multiple projects at the same time
- Ability to easily write plugins in Java or scripting languages
- Instant access to new features with little or no extra configuration
- Easy integration with the source control system
- Central repositories for JARs and other dependencies
And many more…
Downloading Apache Maven
Apache Maven 3.6.0 is the latest release and recommended version for all users from here: https://maven.apache.org/download.cgi
Following are the system requirements for the download
|JDK Version||For Maven 3.3.0 and higher versions, JDK 1.7 and above version required. For building against JDK version of 1.3 and other, one can use the Toolchains|
|Memory||No particular requirement as such|
|OS||No minimum requirement|
|Disk||10 MB for Maven Install while additional space for the local repository. Approx. size of 500 MB additional space for the local repository|
Installing Maven on Windows
1. Make sure required JDK version is installed on your device before installing Maven.
2. Download Maven from https://maven.apache.org/download.cgi
Select the Link option apache apache-maven-3.6.0-bin.zip to download the zip file
3. Save the file on your local server
4.1 Unzip the file to a New user-defined folder in C: (here C:/Maven
4.2 After unzipping, it appears like this:
5. 1 Go to-> View advanced system settings->Advanced->Environment Variables …->New
Give the Variable name and Variable value as follows:
5.2 Variable Name: MAVEN_HOME
Variable Value: C:\Maven\apache-maven-3.6.0
Note that here the variable value is the path where you unzipped your downloaded Maven files as shown in the image below.
6. Add ‘%MAVEN_HOME%\bin’ to PATH
Add the ‘%MAVEN_HOME%\bin to the path
You have successfully installed a Maven application.
7. To Verify, open the command prompt
Now, type the command ‘mvn –version’ and click on enter
All the information with respect to the current version of the tool and MAVEN_HOME location will be displayed on your screen.
Congratulations!! Maven Installation is successful! You can now use your maven repository for your work.
If you get any error as follows
‘mvn’ is not recognized as an internal or external command, operable program or batch file
Check if your %MAVEN_HOME%\bin is correctly added to the mentioned ‘path’ system variable. If not, add it and again run the command and check
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK, not a JRE
As mentioned initially, kindly make sure about the JDK file and version you have on your system or have installed for the same. Please refer to the requirements table for more details about the version required for Apache Maven installation. If the problem persists, check if the JAVA_HOME system variable is properly configured. If not, configure it and repeat the installation process.
This has been a guide on How to Install Maven?. Here we have discussed basic instructions and different steps to install maven. You may also look at the following article to learn more –