Difference between Maven and Apache Ant

Build tools are programs to manage and automate build process of your application. By build process means compiling source code, linking the packages, bundle them into an executable binary.

Maven and Apache Ant are popular build tools from Apache.

Here are key some key differences in both tools:

Apache Ant             Maven
Ant is flexible and does not impose coding conventions. You need to specify the source of code and the destination.

Maven uses conventions. It knows where your source code is automatically, as long as you follow these conventions. You don’t need to tell Maven where it is.

Ant is procedural. You have to tell Ant exactly what to do; tell it to compile, copy, then compress, etc.

Maven is declarative; All you have to do is create a pom.xml file and put your source in the default directory. Maven will take care of the rest.

Ant doesn’t have a lifecycle.


Maven has a lifecycle. You simply call mvn install and a series of sequential steps are executed.

In Ant, you would first have to JUnit JAR file is, then create a classpath that includes the JUnit JAR, then tell Ant where it should look for test source code, write a goal that compiles the test source and then finally execute the unit tests with JUnit.

Maven has intelligence about common project tasks. To run tests, simply execute mvn test, as long as the files are in the default location.

Ant is simply a build tool. 

Maven is more of project management tool.

Apache Ant


Maven : Install Maven on Linux Machine
In the previous post we have seen how to install JBoss web server on linux machine. This post will guide you to install Maven on the linux machine.

Maven is a project management tool from Apache based on POM (Project Object Model). It is declarative; All you have to do is create a pom.xml file and put your source in the default directory and it will take care of the rest.

Install Maven

1) Download Maven-tool
sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
sudo sed -i s/$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
2) Install using yum command
sudo yum install -y apache-maven
3) Check version
mvn --version
4) Done
Back << Install JBoss on Linux                       Next >> Install Apache Ant on Linux