Thursday, June 14, 2012

Installing Maven On CentOS


http://key2start.wordpress.com/2011/04/05/maven-on-centos/

These are the simple sequences for making maven work on a CentOS machine.

Pre-requisite : Java to be installed, check using java -version

1. Download the current maven version from the prescribed repository, http://maven.apache.org/download.html. I use to work with maven version 2.0.11 and hence downloaded using,

> wget http://www.eng.lsu.edu/mirrors/apache//maven/binaries/apache-maven-2.0.11-bin.tar.gz

Please wait while it is downloaded as a tar archive.

2. Extract the archive to the desired maven home directory, which can be a common, /usr/local/

So move the downloaded apache-maven-2.0.11-bin.tar.gz to /usr/local/ path using mv command or a short way can be use the wget command told before after going to the /usr/local/ path. Any way no issues..

> mv apache-maven-2.0.11-bin.tar.gz /usr/local

> cd /usr/local

> tar -zxvf apache-maven-2.0.11-bin.tar.gz

This will extract the apache-maven-2.0.11 directory into /usr/local/

3. Create sym link..

> ln -s apache-maven-2.0.11 maven

4. Open ~/.bashrc file with vi ~/.bashrc and add the following lines to the end of the file,

export M2_HOME=/usr/local/apache-maven-2.0.11
export PATH=${M2_HOME}/bin:${PATH}

5. AT last execute the environment changes with the command,  

> . ~/.bashrc

Check the installation with,

> mvn -version

No comments: