1. Download maven
- From the following website:http://maven.apache.org/download.html
2. Configure maven
Unix-based Operating Systems (Linux, Solaris and Mac OS X)
- Extract the distribution archive, i.e.
apache-maven-2.2.1-bin.tar.gzto the directory you wish to install Maven 2.2.1. These instructions assume you chose/usr/local/apache-maven. The subdirectoryapache-maven-2.2.1will be created from the archive. - In a command terminal, add the
M2_HOMEenvironment variable, e.g.export M2_HOME=/usr/local/apache-maven/apache-maven-2.2.1. - Add the
M2environment variable, e.g.export M2=$M2_HOME/bin. - Optional: Add the
MAVEN_OPTSenvironment 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
M2environment variable to your path, e.g.export PATH=$M2:$PATH. - Make sure that
JAVA_HOMEis set to the location of your JDK, e.g.export JAVA_HOME=/usr/java/jdk1.5.0_02and that$JAVA_HOME/binis in yourPATHenvironment variable. - Run
mvn --versionto verify that it is correctly installed.
3. Add the following two lines to .bashrc
export M2_HOME=/home/hcao/apache-maven-2.2.1
export PATH=$M2_HOME/bin:$PATH
Run "source .bashrc"
Labels