How to Install Maven in Eclipse IDE ? – Build Tool for java

In this article i will talk about how to install maven in eclipse IDE. Maven is basically a build tool for java based projects.

There are two ways to install maven in eclipse IDE. First one is to install directly in Eclipse IDE via Eclipse MarketPlace / Install new software from help menu of Eclipse IDE & second one is, Install it on your machine manually & then configure the installation details in Eclipse IDE.

Let us talk about both methods.

1.  Install maven directly in eclipse IDE via eclipse marketplace or install new software from help menu

Follow below steps one by one

Open Eclipse, Go to Help Menu on Top right hand side & click on install new software.

Install maven 1

Add depository for downloading M2e as shown in below image.

Install maven 1

Then select work with as the current URL that you have added. It will show you the list of Maven Integration tools for Eclipse IDE. Select the desired one & click on next. Shown in below image

Install maven 1

Click on the next, below screen will show you the current installation items that you have selected.

Install maven 1

Now accept the Terms and conditions of license agreement & click on finish button so as to start with installation of maven plugin inside eclipse IDE. Shown in below image.

Install maven 1

Finally, You can see that software installation has begin. Shown in below image

Install maven 1

Once installation is finished, do restart your machine.

This is how we can install maven inside Eclipse IDE.

 

2. Another way to install maven is Install it in your machine & then configure it in Eclipse IDE.

Follow below steps to get the installation done using above method.

Download Maven files from : https://maven.apache.org/download.cgi

or click here apache-maven-3.5.2-bin.zip

Then Extract it to some folder. Let us say i am extracting it in my C:/ drive. So path of maven files is : C:\apache-maven-3.5.2

Now, Setup Environment Variables.

Go to start program, type “env“, in search result you can find option to edit environment variables. Click on it. Refer below image –

install maven

Once you click on it, System properties will open. Click on Environment variables. As shown in below image.

install maven

Now add below variables by clicking on new button for system variables.

JAVA_HOME=C:\Program Files\Java\jdk1.8.0_111
M2_HOME=C:\apache-maven-3.5.2
M2=%M2_HOME%\bin

Once above variable setup is done, Edit the “Path” variable. Enter below path at the end of current path (Do not modify anything other than this unless you are sure about it)

Path=;%M2%;%JAVA_HOME%\bin

install maven

Once this is done, click on OK. Now you are done with environment variable setup. Now you can verify if maven is installed correctly on your machine or not.

To check this, open command prompt & type below command.

mvn -version

Result of above command should show the currently installed maven version (This means maven is installed correctly) Refer below image.

install maven

Next part is now, to configure this installed maven in to your eclipse IDE.

Before we update anything in Eclipse IDE, first we need to modify setting.xml file from maven installation directory. Here we need to add the path of current maven repository at correct position. refer below image.

Location of settings.xml file: C:\apache-maven-3.5.2\conf\settings.xml

install maven

In the above image, the highlighted line need to be inserted at correct position, as shown above. Save the file.

Now let us update Eclipse IDE. To do this, Click on Window & go to preferences of your Eclipse IDE.

Go to maven –> Installations. Window will looks like below.

install maven

Now click on Add, and add the path of your current maven directory here & Click on OK. refer below image.

install maven

Now go to user Settings in the same menu & add path of your settings.xml file (Located in conf folder of your maven installation directory)

install maven

Click on OK.

That’s it, now done.

Clean your project & start with new maven project. You should be good to start with creation of maven project.

Refer below video for the same –

Refer below article to know about how to create new maven project.

How to create maven project in Eclipse IDE

 

Put your comments if you have any issues !!!! Thanks !!

 

 

 

 

Leave Comment

Your email address will not be published. Required fields are marked *

Looking for learning Framework Development from Scratch? Lookout for Detailed Framework Development videos on YouTube here -

https://www.youtube.com/automationtalks

Get the Framework code at Github Repo: https://github.com/prakashnarkhede?tab=repositories