I was reading this blog by Kent R.Spillner regarding java build tools. Although I have lightly used Ant and Maven, I didn't have commited to either one seriously which I intend to do. Is the blog post I linked an exagerated one? Most importantly, should I use Maven or Ant for a medium sized project ( approximately 20K LOC).
-
7This article is very old. Use maven or gradle. – MariuszS Dec 24 '13 at 07:26
-
12"The best build tool is the one you write yourself...." don't listen to advise like that. Builds are complicated enough without each developer inventing their own custom way to build their code. On this point this is why Maven/Gradle might win-out over ANT, they encourage build standardization. Try supporting more than 4-5 projects and you'll understand it's importance. – Mark O'Connor Dec 24 '13 at 10:22
-
2It is unfortunate that article ranks so highly in google for a query of "Ant vs Maven." IMHO the entire thing reeks of the kind of hyperbole that can only result from working in isolation, where one is free to reinvent the wheel as much as they like without having to justify the added complexity to their team. The term "optimized for philosophy" jumps to mind when reading. – DeaconDesperado Jun 17 '14 at 17:27
-
1Ant is a good tool, but you need to have experience to use it properly and skill, which take years to acquire. Maven standardizes everything and works for medium sized projects, but as soon as you get into any customization you hit a wall. It's not unusual to spend days (literally) trying to figure out the correct way to configure a mvn plugin. Also it's very verbose xml, which makes readability an issue. Gradle is awesome. If you're a java developer and use it for even a little bit, you will very quickly see advantages. IMHO gradle eliminates the need for ant or maven entirely. – niken Jul 14 '16 at 18:46
1 Answers
It really depends. Maven and Ant are just different approaches: imperative and declarative (see Imperative vs Declarative build systems)
Maven is better for managing dependencies (but Ant is ok with them too, if you use Ant+Ivy) and build artefacts. The main benefit from maven - its lifecycle. You can just add specific actions on correct phase, which seems pretty logical: just launch you integration tests on integration-test phase for example. Also, there are many existing plugins, which can could almost everything. Maven archetype is powerful feature, which allows you to quickly create project.
Ant is better for controlling of build process. Before your very first build you have to write you build.xml. If your build process is very specific, you have to create complicated scripts. For long-term projects support of ant-scripts could become really painful: scripts become too complicated, people, who's written them, could leave project, etc.
Both of them use xml, which could become too big in big long-term projects.
Anyway, you shoud read specific documentation on both. Also, there is ant-maven-plugin, which allow to launch ant-scripts with maven.
P.S. You can take a look on Gradle, which for me could provide more freedom than Maven, but is easier to use than Ant.

- 4,376
- 11
- 45
- 60