4 ms·
Ant and Maven are fairly obsolete at this point in the Java world having been superseded by Gradle, and so aren't really worthy of much discussion. But Gradle i
by dlandis 11y ago
Ant and Maven are fairly obsolete at this point in the Java world having been superseded by Gradle, and so aren't really worthy of much discussion. But Gradle is quite good and I think it would stack up very well against the others including sbt. Like sbt, I think it fuses a task based and configuration based approach and also does dependency management.
- aikah 11y agoIsn't Gradle based on and using Maven (under the hood) ?
- smadge 11y agoGradle allows you to 1) use maven plugins 2) download dependencies from maven repositories. So my understanding is that Gradle is backwards compatible but separate.
- smadge 11y agoYikes, I still use Maven. I don't like being left behind in the dust. Is there any compelling reason to prefer Gradle? What mistakes did Maven make that gradle avoided? One thing I am hesitant about is the I don't need my build tool to be a turing complete language.
- a_imho 11y agoTechnology radar [1] said 'Adopt' in 2013: "Language-based build tools like Gradle and Rake continue to offer finer-grained abstractions and more flexibility long term than XML and plug-in based tools like Ant and Maven. This allows them to grow gracefully as projects become more complex." My personal opinion after managing the build system of a fairly complex java project for years, I'm glad we skipped Maven in the evolution. For me the most important part was error messages, and the most helpful were Ant > Gradle > Maven. We had very different conventions than what Maven offered, and shaping it to our process was cumbersome. Coupled with Maven 2.x and 3.x never played nicely together (at least for me), now when I see a Maven build I just sigh (looking at you Atlassian) Finally, strictly personal observation, but Ant/Maven tend to correlate with SVN (or older VCS) usage, which you can argue still does its job, but is pretty much considered obsolete. [1] https://www.thoughtworks.com/radar/a-z#gradle https://www.thoughtworks.com/radar/a-z#gradle
- smadge 11y agoThanks, this is helpful! I didn't know about Technology Radar before now. Interestingly, they say "Subversion moves back into the Adopt section of the radar because it is a solid version control tool suitable for most teams."
- rlonstein 11y agoWatch for complexity. Circa 2000 when Ant was popular I leveraged jython and inlined small python scripts into the rewrite of a grossly hairy onion of make, shell, and perl scripts that comprised a build system for a sprawling collection of JDK1.2/1.3 apps. In hindsight, this was probably a mistake because it solved the problems of "We can't manage this!" and "Anything outside the JVM is not portable!" it made very little inroad against complexity.
- twic 11y agoFor small projects, like a library or something, there isn't a huge difference. Your build is likely to follow the stereotypical compile - test - package cycle which both tools support out of the box. There are a few advantages even for simple projects, though: * I really like Gradle's wrapper feature, which means you can check in a small bootstrapper which downloads Gradle when you need it. That means you don't have to worry about installing the build tool, nor making sure you have the right version. It makes projects self-contained. * Gradle caches downloaded dependencies in a directory which is distinct from your local repository. Maven just drops things into the local repository. To me, what Maven does is a fundamental confusion of purposes, and it makes it a headache to clean the cache, because you have no idea what is cached, and what is an irreplaceable locally-built artifact. Conversely, it makes it tough to look at your repository and work out what is an official artifact that came from the internet, and what is some crummy local thing you shouldn't rely on. * Gradle knows about dependencies between tasks, and between tasks and files. When you run a build, Gradle can be fairly smart about what tasks it runs. If you're tweaking the packaging step, re-running the build won't run compile and test if the code hasn't changed. If you just want to run functional tests, tell Gradle, and it will re-compile if necessary, but won't unnecessarily run the unit tests. Doing this with Maven involves manually working out what phases are necessary for what you want to do, and then listing them all on the command line. Gradle starts to pull ahead significantly for large projects, though. In those, you inevitably need to do more complicated things - code generation, running special tools, multiple kinds of tests, including extra bits and bobs in the packaging, etc. For those, Maven rapidly becomes painful, whereas Gradle's difficulty scales no more than linearly with the challenge. On the flip side, there's no significant downside to Gradle itself. It's perhaps fractionally slower. It opens the door to writing loads of Groovy code and making your build a nightmare, but there's a simple way to avoid that - just don't do it. You never need to write full-blown code to do anything you could do in XML in Maven; you only need to write code where you would also need to do so in Maven, as a plugin. And when that does happen, you'll find that writing plugins is also much, much nicer with Gradle than with Maven, and there are really lightweight ways to start - you can write new task definitions right in your build script (which is not nightmare-inducing, because they work inside the normal Gradle flow), then move them out to external modules as you wish. I'd suggest giving Gradle a go on a small project, one where you don't anticipate a lot of build complexity, just to get a feel for it.
- tdurden 11y agoAnt maybe, but Maven is hardly obsolete. Most every Java project I run into uses Maven or Gradle, with Maven being more common.
- pkd 11y agoDefinitely not Maven. Maven is ubiquitous in Java projects. Gradle has been pushed hard by Android, but I know that a lot of developers aren't convinced that putting code into configuration is a good idea. Maven even after all the XML crud remains insanely flexible and powerful.
- TeMPOraL 11y agoI have no opinion on Gradle at this point, though the developers you mention probably need a casual reminder that code == data, and complex enough XML spec is indistinguishable from a poorly formatted Abstract Syntax Tree (or Lisp code).
- twic 11y agoMaven is really not insanely flexible. I have a build in which i wanted three distinct test phases (unit, functional, and API contract). A simple requirement. But i couldn't have that without writing a plugin, or breaking out a dummy module for one of them. We ended up making the contract tests a special case of the unit tests, selected by passing in some flags; a consequence of that is that it's impossible to run both sets of tests in a single build. tl;dr: Maven is the exact opposite of flexible.
- kzhahou 11y agoGradle has superceded Maven in the same way that Node has replaced Java and C++ in production (hint: it hasn't).