2007年3月6日星期二
Maven vs. Ant
一个不错的比较,摘自OTN
Making the Choice
The build process is a key component in any J2EE project, and there are a number of build tools to choose from. For the purposes of this article, our discussion will be limited to two of the most popular J2EE build tools: Maven and Ant.
Maven and Ant are open-source projects from the Apache Software Foundation, and choosing between them is one of the most important decisions a project leader can make. Maven aims to help developers build, test, and document their Java projects easily and in a consistent way. It is a powerful tool, and it can very helpful for managing a project during its life cycle.
Ant is the most popular build tool in the Java world. It is a very flexible tool; however, this flexibility comes at a price. Many enterprise projects suffer from obese Ant scripts, which are difficult to manage after the build owner leaves the group.
To help you choose between these tools, here is a high-level comparison:
| Ant | Maven | |
| Installation | Very easy | Very easy (very similar to Ant) |
| Time to start a new project | 5 minutes | 15 minutes |
| Time to add a new functionality | 10 minutes to add a new target | 2 minutes to use a new goal |
| Time to learn for a new developer | 30 minutes. Very easy to understand, and very good tool support. | 2 hours. Can be confusing at the beginning. |
| Standard layout | No (which is good; you can do whatever you want). | Yes (which is good, all your projects will look the same). |
| Multi-project support | Yes, but you have to do your own master build file. | Yes, with the Maven Reactor |
| Documentation generation | No standard way to do it, but there are plenty of available tools. | Yes |
| IDE integration | Yes | Very basic |
My recommendation is to choose Ant if you know what you're doing and want absolute control over your build mechanism. However, if you are unsure about your project structure and do not have much experience with build systems, choose Maven. Maven will provide you with a good project layout and excellent tools to help you across the whole project life cycle.

没有评论