Saturday, June 4, 2011

How to Install Maven in Ubuntu

Step 1
First you need to download Maven from the maven site : http://maven.apache.org/download.html
Select the latest version of Maven & make sure to download the *.tar.gz version.
eg : apache-maven-3.0.3-bin.tar.gz

Step 2
Now you have the gz file with you & copy the gz file to the place where you want it to be installed.

Step 3
right click on the .gz file & select Extract Here option.

Step 4
Now copy the path of the Maven folder.
You can do this by right clicking the folder tab & select copy; it will copy the path.

Step 4
Now go to your Home Folder

Step 5
go to View menu & click on Show hidden Files menu. View -> Show hidden Files
or press ctrl+H

Step 6
Now start typing .bashrc in the Home Folder & then .bashrc file will be selected.

Step 7
Double click to open it & goto the bottom of the page.

Step 8
Insert these two commands to set the path for the Maven.

EXPORT MAVEN HOME =/home/yourname/foldername/apache-maven-3.0.3
EXPORT PATH = $MAVEN_HOME/bin:$PATH

Step 9
Right now you are done with maven. check whether it is working correctly by inserting this command in the terminal.
mvn -v

This will display a set of statements as below.

Apache Maven 3.0.3 (r1075438; 2011-02-28 23:01:09+0530)
Maven home: /home/xxxxxxxxx/myprograms/apache-maven-3.0.3
Java version: 1.6.0_25, vendor: Sun Microsystems Inc.
Java home: /usr/lib/jvm/java-6-sun-1.6.0.25/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.38-8-generic", arch: "amd64", family: "unix"

If you can see something similar to above, be happy. because oyu have successfully installed maven in your machine. :)

5 comments:

  1. export MAVEN_HOME="/home/yourname/foldername/apache-maven-3.0.3"
    export PATH="${MAVEN_HOME}/bin:$PATH"

    ReplyDelete
    Replies
    1. Yes Heraldo you are correct.. Space should not be there & the code segment is also applicable.

      Delete
    2. Lower case export is mandatory otherwise it does not work.

      Delete
    3. Well farid, in some cases its working when it comes to linux environment.

      Delete
  2. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java EE Online Training from India . Nowadays Java has tons of job opportunities on various vertical industry.



    Java Online Training

    ReplyDelete