Maven versus Ant

The Java world has two popular build tools, Ant and Maven. I've been using Ant for as long as I can remember. Maven is a newer tool aimed at addressing some of the pains of Ant and also providing an more complete experience.

For a long time I avoided Maven. I tried out Maven 1.0 early on and was frustrated with the lack of control and underdeveloped eco-system. With its dependency managment system, dealing with dependencies that are not in public repositories is annoying, and early on most libraries didn't have versions in the public repositories.

I'm working on a Scala port of my iTunes Export application and I had to decide how I wanted to build the project. Here are the pros/cons I saw:

  • Well Known - I know how it works, and there are tons of examples
  • Malleable - I can make it do what I want. I never have to fight the tool to make it work the way i want.
  • Less boilerplate code - Maven provide you many features, like compling and assembling packages 'for free'.
  • Dependency Management - Project dependencies are automatically downloaded from public repositories and your releases can be uploaded to public repositories for distribution.
  • Its the new Black - It is the current 'standard'.
For iTunesExport Scala I'm using Ant, although I am providing a Maven pom file as well for developers that prefer Maven. The basic Maven project was easy to setup, but I found myself struggling to make other things work, like unit testing (It doesn't work out of the box with ScalaTest) and packaging. In Ant, I already have predefined targets for most of what I want, and it takes just a few seconds to tweak to my exact desires.

For larger projects, I think Maven is worthwhile. The dependency managment is important as projects grow and the Maven ecosystem is large and growing. For small projects, I'm sticking with Ant.


  1. I'd encourage you to look into simple-build-tool, a native Scala build system. I've only started to play around with it, but so far it seems to be really good at bootstrapping itself. It interoperates with Maven (well, actually Ivy which is a sort of stripped-down Maven) for dependency management, and your project specification (build.xml / pom.xml) is determined by a scala class you write.

    Personally I'm allergic to ant because I've tried to use it for large-scale projects and seen firsthand how ungainly it can be. I like a lot of things about maven but I've used it enough that the bloom is off the rose by now. I don't have a large Scala project to work on, but sbt has seemed very well thought-out for the small hobbyish things I've tried it with.

  2. Tim,

    Thanks, I took a look at simple-build-tool and I like it. The console is different but really makes sense after a while and is much faster than constantly re-launching Java.

    It really feels like a light version of Maven. Same 'commands', default directory structure, and out of the box usability. My project is still pretty basic so I didn't really stretch the configuration much.

    The only issue I have is packaging. It comes with a nice package command, but I didn't see any easy way to package the releases the way I like them.

  3. If you explain a bit about your way of packaging, I'll try to help with that. Also, please don't hesitate to use the mailing list for further questions or with any suggestions.


  4. Thanks Mark, your help in the mailing list has been helpful. Anyone interested can see what the conversation here.