One of the fundamental differences between Ant and Maven is in whose responsibility it is to understand the build process and the tools used therein.
With Ant, it's the developer who must understand what the tool is
and how it applies to their development. With Maven, build process
knowledge is captured in plugins
, small snippets of
processing that rely on you providing some information.
To compile your java code using Ant, you must first write a build.xml file which uses Ant's javac task, passing that task the correct set of parameters.
You'd then call this build.xml file using ant from the command prompt
ant compile
This isn't too hard to do, and as you move from project to project you become better at this, and understand Ant better, learning what each of the options is for and what the best way to write these snippets is.
Maven, however, takes a far more declarative approach. You must provide Maven with some information about your project (in a file called project.xml), one piece of which is your source directory that stores your java code.
To compile your code, you just need to specify that you have a
sourceDirectory
and then ask maven to compile using
maven java:compile
There's no need for the developer to understand how to write a plugin
to use one. And several plugins can share the same information. For example
the plugin that checks source code conforms to a coding standard uses
the same sourceDirectory
as the plugin that compiles code.