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 Maven or Ant? 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 "Maven or Ant?" Watch "Maven or Ant?" New topic

Maven or Ant?

Haulyn Jason
Ranch Hand

Joined: Jul 24, 2007
Posts: 37

I always use Ant as build tool, recently, all my friends and mates told me that maven maybe a better choice. I read something about maven, it look just a little more dependency of jar management features, not too much about others.

Can anybody tell me should I use maven in my next project? Or still use ant? And more thank you if you tell me why.

ps: the next project is a big project, with many modules, inlucding EJB, JMS, different style webservice, web and swing clients, even python clients.

Always thanks.

Mama always said, "Life is like a box of chocolates; you never know what you're gonna get. And then you have to get medieval on somebody's buttocks."
arulk pillai
Ranch Hand

Joined: May 31, 2007
Posts: 3371
These are complementing technologies. Both have their pros and cons. I have been using maven2 and quite pleased with it. Major benefit is its uniform approach and maintainability. Especially in large pojects, unless someone can write quality short build files that are maintainable, euable, etc go for maven2. It has plugins for Ant as well. Maven2 is more than just a build tool.

[] | [Java job hunting know how] | [Java resumes]
Haulyn Jason
Ranch Hand

Joined: Jul 24, 2007
Posts: 37
OK, but My IDE is not eclipse or netbeans, it's JDEE, full features support for ant but not maven, should I make maven works with ant? or ant works with maven?
I am an ant user, so the classpath setting looks strange for me to use ant with maven.

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15080

You can use Maven and Ant together; there is a JAR with Maven tasks for Ant. If you use it like that, you can use Maven to manage the dependencies and use Ant for building.

I've tried Maven and it's very useful for managing dependencies, especially if you're using libraries such as Hibernate, that have a lot of dependencies themselves.

One of the main differences between Ant and Maven is that in Maven you tell the tool what to build (in a pom.xml file), as opposed to how your project should be built (in an Ant build.xml file). Maven will figure out itself how to build your project from the specification in the pom.xml file.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 10031

Use Maven, its much faster than ANT and I find it amazing.

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33098

Originally posted by Jothi Shankar Kumar Sankararaj:
Use Maven, its much faster than ANT and I find it amazing.

What makes it faster? I would think both have to do similar work - compile, jar up things, etc. Or do you mean faster to write?

I do agree that Maven is better if one is doing things "the Maven way", I'm just curious about the performance component.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Haulyn Jason
Ranch Hand

Joined: Jul 24, 2007
Posts: 37
ok, my question is : if I use maven as maven way, should I supply ant task for my emacs easily? do not need to set very very complex classpath and others?

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

The benefits of Ant include its transparency and flexibility. You know exactly what it's going to do and you can arrange your project however you like.

Maven, on the other hand, constrains you to a specific project structure (By default). A lot of Maven's work is "magic", so you can't easily tell what it's going to do. However, Maven makes up for it by having a very powerful means of fetching and publishing shared code resources, and these days most non-trivial projects use shared code such as Apache Commons by the bucketload.

The predefined project structure of Maven is also a plus in that once you've seen one Maven projects, you've pretty much seen them all. You don't have to adapt to individual tastes in project layout.

There's no one solution. I use both. Mostly when I'm building code for external shipment I use Maven, since a Maven project is more easily capable of setting itself up on a blank computer. However, I've got one major project that's Ant-based, since one of its subsystems cannot be built properly by Maven - the "mojo" in question is orphanware and I need an update to the official public version of said mojo before I can freely distribute what I've got.

An IDE is no substitute for an Intelligent Developer.
Alan Hadsell

Joined: Oct 01, 2008
Posts: 1
I like Maven. Its strong points are:
  • Dependency management
  • Standard project structure

  • However,
  • The documentation is fragmentary and often contradictory
  • The "magic" someone mentioned above can get in the way when you're trying to do something that the Maven folks haven't anticipated.
  • Integration with Eclipse, especially with the web test project (Run On Server) is problematic.

  • I really like the transparency and simplicity of Ant, and its integration with IDE's, so I use Ant tasks for Maven to let each tool do what it's good at.
    Yves Zoundi
    Ranch Hand

    Joined: Aug 31, 2008
    Posts: 47
    You probably want to give Maven a try. In the past, people could ignore Maven existence, no real documentation in early 1.x versions, to complicated to setup, etc. More and more projects are using Maven, many articles show some examples and provide source code with Maven projects. If you don't know or understand Maven, it will hurt you one day or another(maybe your next job: You have 10 years of experience? Do you know Maven?).

    If your team is not familiar with Maven you'll probably have some resistance. Switching with Maven will affect their productivity and they'll have to learn Maven.

    Most guys I've met, don't know how to use it and when they do, they remember most commands by heart... There's no need to do that really, some IDEs have decent support for Maven.

    So far, Netbeans has the best Maven support, nothing compared to what IDEA, Eclipse(m2eclipse or Q4e) provide. Eclipse support for Maven 1.x was the best in the past though, in my opinion.

    I would probably never use Ant for a non trivial application, if I have the choice, and if the project build process isn't simple. I wouldn't be attracted to join a huge project which has tons of large Ant files.

    Author of VFSJFileChooser and XPontus XML Editor
    I agree. Here's the link:
    subject: Maven or Ant?
    It's not a secret anymore!