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 vs ANT

ANT focuses only on building a project. Wherein Maven focuses on dependency management and build management.

ANT is simple, easy to learn and use. With just few basic commands, we are up and running in ANT. In comparison with ANT, Maven is difficult for a novice to understand and use.

Maven has a build lifecycle convention like compile –> package –> install (approx. for understanding). In ANT, we need to explicitly define goals/targets for these standard objectives too.

In general ANT project does not rely or link to external dependencies outside the project. With Maven, on first use the dependencies have to be downloaded from a repository.

There are popular public repositories available for Maven and downloading common jars is easier. With ANT, for shared projects we need to scout for the dependent jars one by one unless they are bundled.

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

if I will be collaborating with multiple persons

are there multiple number of dependent jars and their size

is the dependent jar a rare find

is it a simple test project, just build, test and dump

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 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.

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.