Apache Maven is an excellent build tool for any software project. It helps you manage the project code and its build process so that your software project stays organized and maintains its focus. Windows isn’t exactly the most popular operating system for developers, but it’s still very much in use by enterprises and end users alike. Luckily, there are ways to install Apache Maven on Windows. Let’s take a look at how we can install Maven on Windows so that we can get to work with it as soon as possible.
Apache Maven required Java Development Kit (JDK) to be installed on the system. Apache Maven 3.3 and above version requires JDK 1.7 or above. So make sure your server fulfills requirements before installing Apache maven.
Setting Up JAVA_HOME environment variable
The first thing that we need to do is set up JAVA_HOME. This is a system environment variable that we need to set up in order to install Maven correctly. In order to set this up correctly, you first need to install a Java Development Kit (JDK) on your computer. The Java JDK is the software development kit that you’ll need in order to be able to write code on Windows. You can find the appropriate version of the JDK for Windows at the following URL. Usually, the best version to use is the latest version of Java. You can find out how to install JDK on your machine in the link above.
Installing Maven On Windows
To download the latest version of Apache Maven, Visit its official website download page. At the writing time of this tutorial, Apache Maven 3.3.9 is the latest version available.
For this tutorial, I have downloaded apache-maven-3.8.6-bin.zip and extract its content under c:\Apache\Maven
Configure MAVEN_HOME environment variable
Now that we’ve installed Maven successfully, we should set up the MAVEN_HOME system variable. This variable holds the path to the directory where your Maven installation is located. If you don’t have an environment variable set up for MAVEN_HOME, then Maven won’t be able to run. Therefore, we need to set this variable up in order to be able to successfully use Maven in our projects.
Apache Maven required MAVEN_HOME and M2_HOME environment variable to set. You also need to add Apache maven bin location under systems PATH environment variable.
Also appened ;c:\Apache\Maven\bin under Path environment variable.
Finally, You have successfully installed Apache Maven on your Windows system. Now open a command prompt and run mvn –version command to verify installation and installed version.
mvn --versionApache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T22:11:4 7+05:30) Maven home: c:\Apache\Maven Java version: 1.8.0_121, vendor: Oracle Corporation Java home: C:\Program Files\Java\jdk1.8.0_121\jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows 8.1", version: "6.3", arch: "amd64", family: "dos"
This is an Apache Maven installation guide. If you want to do any kind of serious Java development, then you’ll need a build tool like Maven. Now that you’ve been through this Apache Maven installation guide, you should be able to install Maven on your computer. If you have any questions, don’t hesitate to ask in the comments below! Now, you’re ready to start building software with Maven. You can also use Maven in your daily work as a developer. It can simplify your work, especially if you work with a lot of different projects at the same time.