Build tools are programs to manage and automate build process of your application. By build process means compiling source code, linking the packages, bundle them into an executable binary.
Maven and Apache Ant are popular build tools from Apache.
Here are key some key differences in both tools:
Ant is flexible and does not impose coding conventions. You need to specify the source of code and the destination.
Maven uses conventions. It knows where your source code is automatically, as long as you follow these conventions. You don’t need to tell Maven where it is.
Ant is procedural. You have to tell Ant exactly what to do; tell it to compile, copy, then compress, etc.
Maven is declarative; All you have to do is create a pom.xml file and put your source in the default directory. Maven will take care of the rest.
Ant doesn’t have a lifecycle.
Maven has a lifecycle. You simply call and a series of sequential steps are executed.
In Ant, you would first have to JUnit JAR file is, then create a classpath that includes the JUnit JAR, then tell Ant where it should look for test source code, write a goal that compiles the test source and then finally execute the unit tests with JUnit.
Maven has intelligence about common project tasks. To run tests, simply execute , as long as the files are in the default location.
Ant is simply a build tool.
Maven is more of project management tool.