• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Maven or Ant?

 
Haulyn Jason
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

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.
 
arulk pillai
Author
Ranch Hand
Posts: 3387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Haulyn Jason
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15354
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use Maven, its much faster than ANT and I find it amazing.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34656
366
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Haulyn Jason
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Thanks.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Alan Hadsell
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
    Posts: 47
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic