GeeCON Prague 2014*
The moose likes Ant, Maven and Other Build Tools and the fly likes Build tools comparison 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 "Build tools comparison" Watch "Build tools comparison" New topic
Author

Build tools comparison

Amit Arora
Ranch Hand

Joined: Jun 14, 2007
Posts: 30
Hi,

I am looking to start a new project (web application in Java/J2EE using Spring). I am looking for build tools which are available. I have heard about Maven and Gradle, providing more features compared to Ant like
  • dependency Management,
  • project structure,
  • convention over configuration,
  • versioning
  • But still not able to find out the best tool that can be used. I have gone through lots of discussion, all are saying Gradle is better compared to Maven, but the articles were published in 2009, I have not found out the new article comparing the features of both Gradle and Maven.
    Please suggest the best build tool.


    Amit Arora
    (SCJP, SCWCD)


    Amit Arora<br />SCJP 1.4, SCWCD
    Pawel Piwowar
    Greenhorn

    Joined: Feb 12, 2010
    Posts: 21
    Hello,

    I've been using Maven for several years in different enterprise projects and could recommend it to you. I do not have any experiences with Gradle, so could not tell you which one is better.
    However I can assure you that if you choose Maven, you will not be disappointed. You can quickly configure your continuous build environment using Maven together with Nexus and Hudson.
    All of them are great products easily installed and maintained.
    There is also another nice feature of Maven: plugins written in Java. There are lot of thems: for example for managing dependencies, starting application server, sql operations.
    If is not enough, you can always write your own plugin, which is easy and well documented.

    And one more thing, as I can see on Gradle site, the last version is 1.0-milestone-3.
    In case of Maven the last version is 3.03, You can also choose version 2.2.1 (I'm currently using it).
    If you start a commercial project using stable version is a must IMO.

    I hope this will help you making your decision


    SCJP 5, SCWCD 1.4, SCBCD 5, SCEA part1
    Amit Arora
    Ranch Hand

    Joined: Jun 14, 2007
    Posts: 30
    Thanks for reply Pawel. I have heard that pom.xml becomes too complex if your project size is getting bigger, moreover you cannot go for scripting in pom.xml (which you may need at some time) and the maven is rigid. All these problems are addressed in Gradle which is groovy based.
    Pawel Piwowar
    Greenhorn

    Joined: Feb 12, 2010
    Posts: 21
    You can modularise your project with parent and child modules. Each module can be a parent for another modules as well. This way you don't have to put everything into single pom.xml.
    Another approach is dividing your big project into smaller independent projects. Each of them producing its own artifacts (jar for example) placed in repository. Your main project becomes smaller and simpler, using artifacts already present in repository. Its not only a remedy for complex poms, but also for making your application easy to maintain. In case of Gradle build I would recommend similar approach.

    Concerning scripting, do you really need it ? For typical tasks like unpacking dependencies or creating EARs, you can use plugins (http://maven.apache.org/plugins/index.html) . Which is simpler and more reliable then creating your own scripts. Or you can create his own plugin in Java, which give you more flexibility and control (JUnit tests for your plugins) then writing scripts.
    However if you insist to write scripts in groovy, you can also do it, by using groovy-maven-plugin.
    Kalpesh Soni
    Ranch Hand

    Joined: Jan 02, 2001
    Posts: 312
    if you find maven learning curve too steep

    you could use ANT with ivy


    Test 094, IBM WID 6.0 cert
    SCJP 1.2
    SCBCD 1.3 Beta
    SCWCD 1.4 Beta
    SCMAD Beta
    SCDJWS Beta

    KS
    Jayesh A Lalwani
    Bartender

    Joined: Jan 17, 2008
    Posts: 2383
        
      28

    I wasn't aware of Gradle until this post, and I looked it up and it seems to me like it's Ant+Ivy in Groovy. It's great if Ant is your cup of tea

    However, personally, after using Maven, I stay away from Ant as far as possible. Ant has tremendous flexibility over Maven, but IMO, that is a short coming of Ant.It's fine for small projects/one-man-two-man shop, but when you are trying to build multiple products with multiple modules each, Ant's flexibility tends to start working against it. There are too many things that you can do wrong with Ant, and generally, developers end up doing it wrong. The thing is doing things the "right way" in ant requires some thought. You need to start thinking about the "design" of your build scripts. However, in most teams where developers write build scripts, the build script is an afterthought. Developers are and should be focused on writing good production code, not on writing good build scripts

    Maven, OTH, being rigid doesn't allow you to mess up as bad as Ant does. All your developers need to worry about is a) which plugin to use, b) which phase to bind the plugin to, c) which dependencies to add to the project. I think the only point where you need to be worried about in a large project is conflicting dependencies, and there are some good practices that you can follow.
    Hussein Baghdadi
    clojure forum advocate
    Bartender

    Joined: Nov 08, 2003
    Posts: 3479

    If you are in mood of evaluating other options, Apache Buildr looks promising and potential.
     
    GeeCON Prague 2014
     
    subject: Build tools comparison