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.
  1. <project>
  2. <target name="clean">
  3. <delete dir="classes" />
  4. </target>
  5. <target name="compile" depends="clean">
  6. <mkdir dir="classes" />
  7. <javac srcdir="src" destdir="classes" />
  8. </target>
  9. <target name="jar" depends="compile">
  10. <mkdir dir="jar" />
  11. <jar destfile="jar/HelloWorld.jar" basedir="classes">
  12. <manifest>
  13. <attribute name="Main-Class"
  14. value="antExample.HelloWorld" />
  15. </manifest>
  16. </jar>
  17. </target>
  18. <target name="run" depends="jar">
  19. <java jar="jar/HelloWorld.jar" fork="true" />
  20. </target>
  21. </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”