File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant versus 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 versus Maven" Watch "Ant versus Maven" New topic
Author

Ant versus Maven

J. Kevin Robbins
Bartender

Joined: Dec 16, 2010
Posts: 949
    
  13

I've been reading the Ant manual and some "getting started" web sites, and one issue keeps coming up. There are many who are of the opinion that Ant is an antiquated tool (including it's author) and my time is better spent learning Maven 2.

Thoughts?


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." -- Ted Nelson
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10096
    
164

The "Similar Topics" area below on this page has certain threads which already contain a discussion about this topic. You might want to take a look at them - one of them has a lengthy discussion.

[My Blog] [JavaRanch Journal]
J. Kevin Robbins
Bartender

Joined: Dec 16, 2010
Posts: 949
    
  13

Yes, I've been looking through those. The opinions are all over the map and some are quite passionate in their choices. I can see that this is almost like a Windows versus Mac religious war with no real answer to be had.

Based on the threads here and on other sites, it appears that Ant is a good starting place. It sounds like it's easier to learn and better documented. Maven sounds more powerful but more time consuming to setup and customize with some features I really don't need, such as pulling dependencies from a repository.

Unless someone can convince me otherwise, I think I'll continue with Ant and consider Maven when and if I find something that I can't accomplish with Ant. Walk first, run later.
Jayesh A Lalwani
Bartender

Joined: Jan 17, 2008
Posts: 2371
    
  28

The debate with Ant vs Maven is more like the debate between C and Java

Ant is
  • procedural
  • more flexible
  • easier to mess up


  • Maven is
  • object oriented
  • less flexible
  • makes it harder to mess up


  • Ant is not a good tool if your project is a large multi-module project that is being worked on. Ant is good for small standalone projects. The project that I came on was 3 years old and had 40 developers working on it. There were hundreds of tasks in the build xml, and the developers would run something like "ant clean install install-web" every time they had to run the build. Not one person in the team knew what these targets did. They were just using that command ritualistically. People who had built the ant build left, and then people added stuff to it, and over 3 years it grew to a mess. I tried to figure out the build. The first thing I did is find a tool that visualized the ant build. I wanted to get an idea of the overall structure before I went into the details. The tool drew a graph with each task a a node and dependencies between tasks shown as lines. I was expecting a large tree. Right? You would expect a few high level tasks that called other smaller tasks that called other smaller tasks. The only way to describe what I got was that it looked like a bus terminal. There were all these nodes on the side, and the lines between the nodes was so muddled up, it looked like a highway. I couldn't even begin to pick the lines apart. It was all spaghetti.

    It's very easy to make a ant build into a spaghetti build. Sure, if you do some "design" you can have a nice ant build. The problem is developers don't spend time designing the build. You just want the shit to build, right? 90% of the time you want to add code, compile, load test data, run unit test, deploy to JBoss. Maven makes that 90% of the tasks very easy

    Edit: If you are learning, I would say that you should learn both, because it would improve your chances of getting a job if you know both. I would prefer Maven over Ant simply because a lot of open source projects are going towards Maven because of the depdendency management features of Maven, and if you start diving into the Open source community, you will find that it's easier if you know Maven already. Maven has a lot of new concepts to learn though. It is a tough choice.

    J. Kevin Robbins
    Bartender

    Joined: Dec 16, 2010
    Posts: 949
        
      13

    Thanks, Jayesh. Excellent summary. That's very helpful. I'll take your advice and learn both. I'll start small with a test app and not our production app.
    Jayesh A Lalwani
    Bartender

    Joined: Jan 17, 2008
    Posts: 2371
        
      28

    Hmm.. if there is a production app that you are going to work on very soon, then I would just learn the build tool that the app uses. Generally speaking, unless build tools are creating huge problems, most established projects don't change their build tools.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Ant versus Maven