Wednesday, August 10, 2011

Maven2 Step by Step

Maven2 Step by Step
------------------------------
1. Download Maven2 [apache-maven-3.0.2-src.zip] from http://maven.apache.org/download.html
2. Unzip the distribution archive, i.e. apache-maven-3.0.2-bin.zip to the directory you wish to install Maven 3.0.2. These instructions assume you chose C:\Program Files\Apache Software Foundation. The subdirectory apache-maven-3.0.2 will be created from the archive.
Note: It is binary distribution file no need to install. If you want to down load installable file then need to install maven.
3. Configure Maven
a. Windows 2000/XP
 Click on Start => My Computer
 Right click on My Computer => Properties.



 System Properties dialog will be open




 Click on Advance => Environment Variables.
 Environment Variables dialog will be open



 Click on system variable New button and add JAVA_HOME variable with value of java JDK location [C:\Program Files\Java\jdk1.6.0_17] and OK.



 Click on system variable New button and add M2_HOME variable with value of maven installation location [C:\Program Files\Apache Software Foundation\apache-maven-3.0.2] and OK.
Note: For Maven < 2.0.9, also be sure that the M2_HOME doesn't have a '\' as last character.



 Click on system variable New button and add M2 variable with value of maven bin location [%M2_HOME%\bin] and OK.



 Select Path system variable and click on Edit button and add java bin & maven bin location at the end of the path value[%M2%;%JAVA_HOME%\bin] and OK.



 Optional: In the same dialog, add the MAVEN_OPTS environment variable in the user variables to specify JVM properties, e.g. the value -Xms256m -Xmx512m. This environment variable can be used to supply extra options to Maven.
Note: It is recommended not to define. Maven internally use system java define values.
 Maven configuration completed now test the maven is working or not. Open command prompt and run mvn –version to maven installation test.



b. Unix or Linux
 Extract the distribution archive, i.e. apache-maven-3.0.2-bin.tar.gz to the directory you wish to install Maven 3.0.2. These instructions assume you chose /usr/local/apache-maven. The subdirectory apache-maven-3.0.2 will be created from the archive.
 In a command terminal, add the M2_HOME environment variable,
E.g. export M2_HOME=/usr/local/apache-maven/apache-maven-3.0.2.
 Add the M2 environment variable, e.g. export M2=$M2_HOME/bin.
 Optional: Add the MAVEN_OPTS environment variable to specify JVM properties, e.g. export MAVEN_OPTS="-Xms256m -Xmx512m". This environment variable can be used to supply extra options to Maven.
 Add M2 environment variable to your path, e.g. export PATH=$M2:$PATH.
 Make sure that JAVA_HOME is set to the location of your JDK,
E.g. export JAVA_HOME=/usr/java/jdk1.5.0_02 and that $JAVA_HOME/bin is in your PATH environment variable.
 Run mvn --version to verify that it is correctly installed.



No comments:

Post a Comment