Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

We have been slowly replacing batch command files (windows .bat) which were simply jarring up the classes compiled in the developers IDE, with more comprehensive Ant builds (i.e. get from CVS, clean compile, jar, archive, email, etc.)

I've spent a lot of time learning (and debugging issues) with Ant, so I'm most comfortable using it for these tasks. But I wonder if Ant is still in as wide usage as it was when I first started learning, or whether "the world has moved on" to something newer (and maybe slicker). (I've started to see more Maven build stuff distributed, which I've never used, for example.)

The practical import of this question, is whether I push new developers to learn Ant, or whether they should be learning something else for builds?

I'm never too on top of the trends, so it would be great to hear from other Java developers what they think is the best build tool, and what they think new developers should be learning.

share|improve this question
    
Read all the answers below and they were all great! Thanks for the insights into what improvements Maven offers over Ant. I will be looking into Maven. –  Sam Goldberg Nov 17 '11 at 18:28
    
It is very few projects that are simple enough not to require tons of scripting for ant. Maven handles a lot of these things in a standard way. –  user1249 Nov 17 '11 at 23:19

7 Answers 7

up vote 18 down vote accepted

I agree with others here that Maven seems to have taken over most significant projects that I've looked at.

While Ant is highly flexible, the build file is not standardized, so when you move to a new project or company, the targets are named differently, the file is structured differently, the inter-target dependencies may or may not be established, etc.

With Maven, you also get the benefit of not having to carry binary dependencies (I'm talking about jars) around in your SCM system. Lots of other great Java tools know how to read a Maven POM file (the benefit of standardization), so tools like IDEs can set up a Maven project very quickly, and build tools like Jenkins can easily execute Maven builds.

share|improve this answer
10  
I should also add that using Maven makes our projects IDE-agnostic, and if you've ever been in a shop that had IDE wars, you can appreciate eliminating this religious battle! –  RonU Nov 17 '11 at 16:35

Take a look at gradle (http://www.gradle.org/). It supports ant. See Using Ant from Gradle: http://www.gradle.org/docs/current/userguide/ant.html

share|improve this answer
    
would you mind explaining more on what these resources do and why do you recommend these as answering the question asked? "Link-only answers" are not quite welcome at Stack Exchange –  gnat Sep 17 '13 at 18:54

Maven has been on the rise for many years, and now I need to learn it. Things will always be changing, and to know that Ant is losing its position is not a bad thing.

Maven may only be the up and comer for a short time, but if it makes our job easier, then it is worth investing the time to learn.

share|improve this answer

Ant may be horrible, but still seems to be the standard. I hear lots of talk about Maven, but I very rarely run into anyone that's actually using it.

share|improve this answer

I think Ant on its own is dead in the water; having to specify all of your classpath dependencies manually (depending on your setup) is far too manual and far to error prone. If Ant is used alongside a dependency management tool, such as Ivy, then it retains it's power and removes the need to manually manage your dependencies.

The other problem with Ant when compared to Maven is the lack of standardization, which has been mentioned in other answers. When moving from project to project or job to job, one of the most annoying things I find is having to learn the new standard for different Ant files. Maven's aim of convention over configuration means that two different projects will have very similar structure, making transition between them much easier than with Ant.

As for whether Ant is still mainstream or not, it will depend on the development environment you are working in. If the project is in a small company or a start-up, I would imagine Maven would be the natural choice and time can be taken to invest in the infrastructure, such as an Artifactory. However, large companies will have invested many years and lots of money into their Ant infrastructure (configurations, global build files etc) which will mean they will be less keen on moving away from a technology in which they have invested so much money.

share|improve this answer

We've been using Maven for several years. It supports Ant scripting (just like Ant supports BeanShell), so your Ant knowledge may still be useful. Maven is much more powerful, but it has some additional infrastructure requirements (you'll want an Artifactory or Nexus server to host your builds if you share components among multiple projects). It's also quite different from Ant, so you can't leverage a lot of your existing knowledge.

share|improve this answer

I've been working with Ant and with Maven. In my experience, Maven has a very strong edge over Ant.

  • All the projects I've seen last 2 or 3 years seem to be using maven. About 3 years ago this made me wonder because maven versions used then (2.0.something) seemed to be quite unreliable and buggy. At some point though (2.1 or 2.2 I don't recall) maven became reliable and after some time spent with it I have changed my mind to opposite. Now, I'd rather be surprised seeing someone who prefers ant over maven.

On a less positive note about maven, my experience with its documentation was not so great so far. I think I've seen a product with documentation worse than that of maven but I can't remember which one (some ancient CSV library iirc).

share|improve this answer
2  
Dunno, I found the Maven Reference quite decent. It is not perfect, and there are dark undocumented corners indeed, but still IMHO it is significantly better than the average. –  Péter Török Nov 17 '11 at 16:13
    
@PéterTörök right Maven Reference is my first aid too. Somehow though most of the stuff that worries me happens to end in these dark undocumented corners. To be precise I find these corners more "dark" than "undocumented" - I mean I feel the knowledge is there but I fail to decipher it. I dunno maybe I am unlucky. Or maybe dumb. Or maybe Maven guys just lack a decent tech writer in their gang –  gnat Nov 17 '11 at 16:36
1  
Why, have you ever seen an open source project which had a decent tech writer? ;-) –  Péter Török Nov 17 '11 at 17:20
    
@PéterTörök so true! :) The luxury of popular OSS projects is that there are a lot of expert guys around who "replace" doc writer. To me that was the case with Maven - there always have been some guru around whom I could ask about tricky things –  gnat Nov 17 '11 at 17:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.