The difference between Apache Ant and Apache Maven

Source: Internet
Author: User

the difference between Apache Ant and Apache mavenCategory: ANT Maven 2013-12-10 18:47 1477 people read review (+) collection report ——— from the Maven authoritative guide
Apache Ant
1. Ant is programmed, and you have to tell ant exactly what to do and when to do it. You have to tell it to compile, then copy, and then compress. 2. Ant does not have a life cycle, you must define the dependencies between goals and objectives. You must manually attach a task sequence to each target.
Apache Maven
1, Maven has a contract, because you follow the Convention, it already knows where your source code. It puts bytes into target/classes and then generates a JAR file at Target. 2, Maven is declarative. All you need to do is create a pom.xml file and put the source code in the default directory. Maven will help you with other things. 3. Maven has a life cycle that is called when you run the MVN install. This command tells Maven to perform a series of sequential steps until it reaches the life cycle you specify. One of the implications of traversing the life cycle journey is that Maven runs many of the default plug-in targets, which complete tasks like compiling and creating a JAR file.

Maven provides built-in intelligence for some general project tasks in the form of plugins. If you want to write a run unit test, all you need to do is write the test and put it in/usr/local/hudson/hudson-home/jobs/maven-guide-zh-to-production/workspace/ Content-zh/src/test/java, add a test range dependency for TestNG or JUnit, and then run MVN test.
If you want to deploy a web app instead of a JAR, what you need to do is change your project type to war and then place your document root directory as/usr/local/hudson/hudson-home/jobs/ Maven-guide-zh-to-production/workspace/content-zh/src/main/webapp. Of course, you can do these things with Ant, but you will need to write these instructions from scratch. With Ant, you first need to determine where the JUnit jar file should be placed, then you need to create a classpath that contains the JUnit jar file, and then tell Ant where it should go to find the test source code, write a target to compile the test source code to bytecode, use June It to perform unit testing. Without the support of technologies such as Antlibs and Lvy (even with these support technologies), Ant feels like a custom programmatic construct.
A set of highly efficient and committed Maven POM in the project, with little XML compared to the Ant configuration file.
Another advantage of MAVEN is that it relies on a wide range of common maven plugins. Everyone uses the Maven Surefire plugin to run unit tests, and if someone adds support for a new test framework, you can get new functionality simply by upgrading a specific plugin version in your project's POM.
The decision to use Maven or ant is not an either-or, Ant has its place in a complex build. If your current build contains some highly customized processes, or if you have written some Ant scripts to complete a clear process in a clear way, and this process does not fit the MAVEN standard, you can still use these scripts in Maven. As a Maven core plugin, Ant is still available. Custom plug-ins can be implemented with ant, and Maven projects can be configured to run ant scripts in the life cycle.

The difference between Apache Ant and Apache Maven

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.