Download, Install and Setup Maven

Maven is a build management tool. It will come handy when we have lots of dependencies, we keep on updating the dependent project, complex build version management. ANT is there for long as a build tool and is popularly used in development. So why do we need Maven?

maven

Maven vs ANT

My personal choice depends on the nature of project, considering facts like below

I am writing this article now because going forward I will be using Maven to build some of the tutorial example projects instead of ANT. In that case, this tutorial might help you to setup Maven. If you are behind a proxyserver which blocks access to Maven repositories, then you have to talk to your IT admin to enable access.

I assume you have already JDK installed.

Step 1: Download Maven

http://maven.apache.org/download.cgi is the link to download Maven. ANT and Maven both are by Apache Software Foundation.

Click and download the ‘Binary Zip’ (Ex: apache-maven-3.1.0-bin.zip) file from the ‘current stable’ version.

Step 2: Install Maven

Maven does not uses an executable file to install. It is just a zip file. Just unzip it to a folder in the hard disk.

Step 3: Setup Maven

1. Add environment variable MAVEN_HOME to the path where you extracted the maven binary zip file.

2. Add path variable, so that we can execute ‘mvn’ command from any location in command prompt.

image

Verify if you have done everything right,

image

This JEE tutorial was added on 03/10/2013.

Comments on "Download, Install and Setup Maven" Tutorial:

  1. Shravan says:

    Could have added something on how to use MAVEN also

  2. Joe says:

    Shravan, getting started with Maven is coming up in a separate tutorial.

  3. Ranjit says:

    Thanks in advanced joe.

  4. Praveen says:

    Looking forward…

  5. Vignesh G says:

    I was struggling yesterday to setup maven. But some how I managed it. But today i am getting such a wonderful blog notes on it. Its really good and will help many learners in future. My congrats to Joe for his patience and quality of the content towards his blog.

  6. Narendran Solai Sridharan says:

    Joe,

    We can use both Maven and Ant together by calling the goals of maven in ant.

    Maven in 5 minutes is a very good tutorial for novice, you can provide references too. http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html

  7. Vinuaj M V says:

    I guess the difference when we use Linux is that, the environment variable ‘MAVEN_HOME’ is set in the .bashrc file. Am I correct?

  8. Pratik says:

    Thanks

  9. […] If you are not aware of what Maven is, then go through my previous tutorial, it has introduction to Maven, how to setup it and Ant Vs Maven, and its […]

  10. Arif says:

    Hi Vinuaj , I am using Linux Fedora 19 can you help me to set maven please ?

  11. Vinuraj M V says:

    Hi Arif, Sorry for the late reply caused because I was not notified by comment through email. Actually this is my guess, that put the environment variable “MAVEN_HOME” in the source file /home/user/.bashrc in Linux. I didn’t tried it at all.

  12. Arif says:

    I am getting below error while doing mvn -version from command prompt. Any inputs?

    Exception in thread “main” java.lang.NoClassDefFoundError: org/codehaus/plexus/c lassworlds/launcher/Launcher

  13. […] Maven is used to manage the dependencies. If you do not have Maven, it is better to download and setup Maven. […]

  14. Anonymous says:

    it is not working properly

  15. […] of the needed Hibernate libraries. If you are new to Maven, go through detailed information for Maven download and setup and Maven in 10 minutes […]

  16. Akshat Gupta says:

    Thanks for this.
    Simplicity at its best :)

Comments are closed for this "Download, Install and Setup Maven" tutorial.