Ant, Maven, and Gradle.
- In the beginning, Make was the only build automation tool, since 1976 and as such
- Apache Ant (“Another Neat Tool”) .
It was initially part of Apache Tomcat codebase and was released as a standalone project in 2000.
make
ant — build automation tool
- In many aspects, Ant is very similar to Make
- simple
- Different phases of a build process are called “targets”
- Ant build files are written in XML, and by convention, they’re called build.xml.
<project>
<target name="clean">
<delete dir="classes" />
</target>
<target name="compile" depends="clean">
<mkdir dir="classes" />
<javac srcdir="src" destdir="classes" />
</target>
<target name="jar" depends="compile">
<mkdir dir="jar" />
<jar destfile="jar/HelloWorld.jar" basedir="classes">
<manifest>
<attribute name="Main-Class"
value="antExample.HelloWorld" />
</manifest>
</jar>
</target>
<target name="run" depends="jar">
<java jar="jar/HelloWorld.jar" fork="true" />
</target>
</project>
- Ant doesn’t impose any coding conventions or project structures — leads to huge XML build files which are hard to maintain
- At first, Ant had no built-in support for dependency management — later Apache Ivy was developed as a sub-project of the Apache Ant project. It’s integrated with Apache Ant,
maven — dependency management + build automation tool
- Maven relies on conventions and provides predefined commands (goals).
- pom, Project Object Model
- uploadArchives task.
will generate the POM and deploys the artifact and the POM to the specified repository. - Maven’s configuration file, containing build and dependency management instructions, is by convention called pom.xml.
- As opposed to Ant, there is no need to define each of the phases in the build process manually.
cons:
- However, though more standardized than Ant files, Maven configuration files still tend to get big and cumbersome.
- Maven’s strict conventions come with a price of being a lot less flexible than Ant.
gradle — dependency management + build automation tool
- was built upon the concepts of Ant and Maven.
- not using XML files, unlike Ant or Maven.
- use DSL, led to smaller configuration files with less clutter since the language was specifically designed to solve specific domain problems
- Gradle gave its build steps name “tasks”, as opposed to Ant’s “targets” or Maven’s “phases”