What is Maven ? How can we configure maven in Windows operating system and set the environment variable?

 What is Maven ? 

Maven is a build automation tool used primarily for Java projects for dependency management. Maven can also be used to build and manage projects written in C#, Ruby, Scala, and other languages. The Maven project is hosted by the Apache Software Foundation, where it was formerly part of the Jakarta Project.

Pre-requisite

Java should be already present in the system and environment variable should be set for java. Refer screenshot


Checking whether maven is already configured in system

Before configuring it is a good practice to check whether maven is already configured in the system. To do that follow the steps:

Search for cmd in windows search bar and click on command prompt. This will open command prompt window in the system.





Please enter any of the following commands in command prompt to check maven is already configured or not.
mvn -v
mvn --version

 If  maven is not configured the command prompt will display the following message while using any of the above maven commands.

 Setting up maven in windows 

Open any browser say google chrome and search for apache maven download in search bar and hit enter.

Click on Download Apache Maven link


After that click on  the link as shown in the below screenshot from Files section



Extract the zip file and will get a folder like one in  the below screenshot




Copy the folder in any drive of your choice. In this blog, I am copying the folder in C:\Program Files. Refer the below screenshot



Now it is time to set maven in the environment variables. Search for environment variables in windows search bar and click on open. Refer the below screenshot


Click on Environment Variables . Refer below screenshot



Now double click on path row from System variables section. Refer below screenshots



Now copy the path of apache maven folder till the bin directory C:\Program Files\apache-maven-3.8.2\bin. Refer below screenshots







Add the copied path and click on OK. Refer below screenshot



Again click on OK. Refer below screenshot



Click on OK one last time. Refer screenshot


Now open a new command prompt window and execute mvn -v or mvn --version and will display the maven configuration details. Refer the screenshot




Note: Maven version can change in the future. At the time of writing this blog maven version is 3.8.2. If you need any clarifications regarding this post, please comment below the comment section.

Comments

Popular posts from this blog