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.
Add depository for downloading M2e as shown in below image.
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
Click on the next, below screen will show you the current installation items that you have selected.
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.
Finally, You can see that software installation has begin. Shown in below image
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 –
Once you click on it, System properties will open. Click on Environment variables. As shown in below image.
Now add below variables by clicking on new button for system variables.
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)
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.
Result of above command should show the currently installed maven version (This means maven is installed correctly) Refer below image.
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
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.
Now click on Add, and add the path of your current maven directory here & Click on OK. refer below image.
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)
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.
Put your comments if you have any issues !!!! Thanks !!