Ant
Ant's hierarchical build script structure is like the following picture.
Ant has a lot of predefined tasks for file system and archiving operations. You can also write your own tasks in java.
<project name="my-app" default="dist" basedir="."
>
<!--Define properties-->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<property name="version" value="1.0"/>
<!--Define targets-->
<!-- create build directory used by compile target-->
<target name="init">
<mkdir dir="${build}"/>
</target>
<!-- compile java code from directory src to directory build-->
<target name="compile" depends="init" description="...">
<javac srcdir="${src}" destdir="${build}" classpath="lib/commons-lang3-3.1.jar" includeantruntime="false" />
</target>
......
</project>
some shortcomings
- XML definition is very limited
- need Ivy for dependency management
...
Maven
Based on the standard project layout and unified build lifecycle.
Standard Layout
eg. all source code sits in the directory src/main/java
Lifecycle
- compile
- unit test and integration test
- assemble (eg. JAR file)
- deploy to the local repository
- release to remote
Dependency Management
No need to explain.
Shortcoming
- too restrictive
- not stable