Running mvn install from the command line will process resources, compile source, execute unit tests, create a JAR, and install the JAR in a local repository for reuse in other projects.
you can run mvn site and then find an index.html file in target/site that contains links to JavaDoc and a few reports about your source code.
Maven POMs contain declarations: “This is a JAR project", and “The source code is in src/main/java“. Ant build files contain explicit instructions: “This is project", “The source is in src/main/java“, “Run javac against this directory", “Put the results in target/classes“, “Create a JAR from the ….", etc. Where Ant had to be explicit about the process, there was something “built-in" to Maven that just knew where the source code was and how it should be processed.
Ant doesn’t have formal conventions like a common project directory structure or default behavior. You have to tell Ant exactly where to find the source and where to put the output. Informal conventions have emerged over time, but they haven’t been codified into the product.
Ant is procedural. You have to tell Ant exactly what to do and when to do it. You have to tell it to compile, then copy, then compress.
Ant doesn’t have a lifecycle. You have to define goals and goal dependencies. You have to attach a sequence of tasks to each goal manually.
Maven has conventions. It knows where your source code is because you followed the convention. Maven’s Compiler plugin put the bytecode in target/classes, and it produces a JAR file in target.
Maven is declarative. All you had to do was create a pom.xml file and put your source in the default directory. Maven took care of the rest.
Maven has a lifecycle which was invoked when you executed mvn install. This command told Maven to execute a series of sequential lifecycle phases until it reached the install lifecycle phase. As a side-effect of this journey through the lifecycle, Maven executed a number of default plugin goals which did things like compile and create a JAR.
The decision to use Maven or Ant isn’t a binary one, and Ant still has a place in a complex build. If your current build contains some highly customized process, or if you’ve written some Ant scripts to complete a specific process in a specific way that cannot be adapted to the Maven standards, you can still use these scripts with Maven. Ant is made available as a core Maven plugin.