This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I liked Better Builds with Maven significantly better than the Sonatype book (complete guide) linked to above. "Better Builds with Maven" covers more real world scenarios and more non trivial scenarios. Both books are available as free PDFs so you can try both for yourself and see which you like better.
One thing I don't like about Maven is the "it just works" mentality. That's awesome until "it doesn't work." The Sonatype book felt like a mix of documentation, minor examples and "it just works." Where "Better Builds with Maven" reads more like a book.
John Todd wrote:Jeanne,
What is your favorite Java build tool? because seriously, I don't like any.
The community should do a better job in this area IMHO.
I don't have one either. I like gradle, but I've only played with it on something trivial (and not a real prject.) Which means I haven't hit any of the annoying real world scenarios. Ant and Maven are both perfectly fine for a simple project without any plugins.
I've used Ant for a lot longer with Maven. And I've written many plugins for Ant. For Maven I wrote one trivial plugin and am currently struggling with my first real/complex one. I find the documentation/resources for Ant to be better. Maybe because it is older?
Maven is great when it works. I like the dependency management/transitive dependencies. I like how you have a hierarchy of POMs. It's still maddening when something doesn't work. Or when you have to figure out what an (undocumented) convention is that Maven is relying on. Hopefully as I gain more experience with Maven I will have less of these moments. However, that's not a strong selling point.
I have used both Ant and Maven in very complex projects. Currently I am making Maven do wonderful things that it was not built for, but for which it is very well suited.
Maven is very much a "black box". If you decide to go with Maven it would behoove you to understand it fully. And the only way to do that is to write some plugins that actually do some work. And writing a plugin that handles a new packaging type is highly recommended - it literally opens up your eyes as to what Maven is doing. And by the way, Maven's handling of dependencies, and its use of repositories to maintain JAR files is its most worthwhile feature.
Ant, on the other hand is pretty much like "make*" for Java. You can get Ant to do just about anything and even use it as a general scripting language.
I recommend that you learn both. Why? Because many open source projects use one of the other for their builds.
* - make is a utility used by C/C++ developers to perform their builds. I have done wild and crazy things with "make" ages ago and have make Ant do similar things.