File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes ant vs maven Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "ant vs maven" Watch "ant vs maven" New topic

ant vs maven

Eshwin Sukhdeve
Ranch Hand

Joined: Mar 15, 2012
Posts: 90
I need to know when we should use maven and when we should use ant .I have idea about ant but dont have idea about maven.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

Maven's strengths are:

* Enforces a standardized project layout. This saves time getting new people working on the project.
* Provides automatic resolution of dependencies, which are cached so that when you have multiple projects, you don't need to keep making local copies.
* Promotes the concept of a resource repository.
* Can create complex products with minimal direction.
* The build environment is pretty portable. You can generally import a clean Maven Project and build immediately with no need to set up a customized external build environment.

Maven's weaknesses are that some people don't like the standardized layouts, and if you have an unusual type of project, you have to either create your own mojo or embed Ant tasks in the POM. Also Maven is "magic", so there's no real way to tell what maven goals can be used on a particular project. Although, conversely, more goals are generally available than there would have been if you'd had to hand-code them all.

Ant's strengths are:

* Flexibility in project organization. If you're just too superior to use someone else's project structure, you can do your own
* Arbitrarily complex builds. For things where a "canned" set of build rules don't cut it, you can define your own.
* Self-documentation. Since there's no "magic", you can tell fairly precisely what goals are available.

Ant's weaknesses are that you can't get automatic resource resolution with basic Ant (although you can use Ivy), you have to code your own rules in detail for each project, and the build environment is only as portable as the person who designed the build.xml forced it to be.

Mostly these days, I use Maven, since my projects are primarily webapps with a dozen or so dependencies. But I still keep Ant around for more specialized needs.

An IDE is no substitute for an Intelligent Developer.
Eshwin Sukhdeve
Ranch Hand

Joined: Mar 15, 2012
Posts: 90
Thanks for usefull information Tim..
Peter Johnson

Joined: May 14, 2008
Posts: 5852

Also, if you search this forum for "ant maven" then you will find numerous prior discussions, such as these:

JBoss In Action
I agree. Here's the link:
subject: ant vs maven
It's not a secret anymore!