Saturday, 14 September 2013

Setting up apache maven

Abstract: Apache Maven has been build to resolve your day to day problems for adding many dependencies that exists in project from various source. Basically, In java you have many dependency to be added to the system. So, It becomes very difficult to manage them by searching Jar files & adding manually to project.
For example - You may need Spring Jars in your project, than after some time you may need Struts Jar. To bring all them in common place in library in your project manually is very complicated & length task. The Maven helps you to add Jars for you making central repository.
All you need to do is add/Modify the POM.XML file.
1) Download the latest version of apache maven
currently the version is 3.1.0.
2) Extract the tar or zipped folder & Preferably place it at  
"C:\Program Files\Apache Software Foundation" location 

Now add M2_HOME an environmental variable , & set the path to where it is placed. 
If you are using windows 7, Follow
        Right click on Mycomputer--> Properties -->Advanced System Settings -->Environmental variables 
In User variables section
Click new ==>Set variable name to -->M2_HOME 
               SET variable value to -->
C:\Program Files\Apache Software Foundation\apache-maven-3.1.0

(Path of maven folder)

In the same dialog box -- Add new variable M2 
 SET PATH TO : %M2_HOME%\bin

Now add the same M2 varialle to the end of your path variable too. 

Make sure you have JAVA_HOME variable set to Java jdk path
 C:\Program Files\JAVA\jdk1.7.0_17 
SET THE PATH VARIBLE TO its   bin directory  as 

Open a command terminal & type : 
mvn --version
It will show you the current version. That's all folks, you get Maven Installed.

In Next Post, I will show you how to create project through Maven add dependency to it. 

Stay tuned.
Happy Learning. :) 

No comments:

Post a Comment