Oct 15, 2015

Project Build Tools | Ant vs Maven

Ant and Maven both are build tools provided by Apache. The main purpose of these technologies is to ease the build process of a project.
Below are some major differences among between the two that everyone must know:
Ant
Maven
Ant doesn't has formal conventions. It uses XML as build file (named build.xml). Maven has a convention to place source code, compiled code etc. It also uses XML as config file (named pom.xml).
ANT requires all the directories supplied as configuration. You have to tell it exactly what to do, like, source dir, target dir, make dir, delete dir, compile this file, etc. Maven requires less configuration than ANT because it works on principle of Convention over configuration and assumes reasonable default.
ANT based project generally use ${lib} as directory to store dependencies. Maven introduced concept of repository, which is a central place to store all libraries, JARs etc. Maven allows you to use central maven repository as well as local repository and automatically download dependency during build process.
There is no life cycle in Ant. You need to define targets and there dependencies. There is life cycle in Maven, which is invoked when you run commands like mvn install. Maven executes a series of steps as a result of this command to produce artifacts.
It is a tool box. It is a framework.
It is mainly a build tool. It is mainly a project management tool and can generate reports etc.
The ant scripts are not reusable. The maven plugins are reusable.
It is less preferred than Maven. It is more preferred than Ant.

This is just a list of differences. Will post a separate article on each one of them soon.
Subscribe at +Java Territory  to stay updated.

0 comments:

Post a Comment