What is Apache Maven?
In simple words Maven is a build automation tool for Java projects.
There are many things which can be written for maven but to get more theoretical details visit Apache Maven-Wikipedia page or can refer to the official Apache Maven website.
Setting-up Apache Maven:
Setup - Windows:
- First download the latest version maven form here. For this tutorial, I have downloaded maven-3.0.4.
- Unzip the downloaded apache-maven-3.0.4-bin.zip. In my case, unzipped it in C:\dev\maven3.0.4.
- Set a new environment variable M2_HOME pointing to the directory where maven is installed or unzipped. In case if you don't know how to set an environment variable in windows, follow the link.
- Set another environment variable M2 with value %M2_HOME%\bin. In the same way create/update the PATH variable with value %M2% so that Maven can be accessed from command line.
- Check if the PATH variable also has the value of JAVA_HOME pointing to the installed jdk.
- Open command prompt (WinKey + R and type cmd) and execute the command mvn --version to see if its installed well.
Setup - Eclipse:
Follow the steps given below to get M2E on eclipse:
- Open Eclipse.
- From the eclipse menu list, go to help -> Install New Software...
- Get maven from the update site "maven - http://download.eclipse.org/technology/m2e/releases".
- Add the maven update site and get the list of plugins provided by it.
- Select the plugin Maven Integration for Eclipse and press next and next.
- Read and accept the terms of license agreement and press finish.
- Restart eclipse.