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'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.
"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
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.
The debate with Ant vs Maven is more like the debate between C and Java
easier to mess up
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.
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.