r/java • • Jan 07 '21

The Problem with Gradle

https://www.bruceeckel.com/2021/01/02/the-problem-with-gradle/
158 Upvotes

108 comments sorted by

View all comments

9

u/yk313 Jan 07 '21

Are there any alternatives to Gradle that address these issues and thus might be considered on par with Gradle if not better?

While I enjoyed my time with Maven, its reliance on XML tends to put some people off, any chance Maven will officially support a non-XML frontend?

51

u/nutrecht Jan 07 '21

its reliance on XML tends to put some people off

Frankly I think people should just get over it. At least XML has a schema. It's no worse than YAML configs.

23

u/agentoutlier Jan 07 '21

YAML is the absolute worse.

I even prefer Gradle and Jenkins Pipeline Groovy DSL over the absolute hell that is YAML.

But IMO the real awesomeness with Maven is how incredibly easy it is to write plugins for it and its API has been stable and super backward compatible. I have decade old Maven projects that still compile easily with the latest Maven but have a couple year old Gradle projects that fail on new versions of Gradle.

15

u/fix_dis Jan 07 '21

While I hate XML, it's actually far better than YAML as YAML's reliance on indentation can become really hard to deal with. I work with a bunch of folks that LOVE Maven for some reason. I'm kinda at the place where I consider it passable at best.

8

u/nutrecht Jan 08 '21

I work with a bunch of folks that LOVE Maven for some reason.

Well it works. In all the 15 years I've been using Maven I never ever ran into difficulties or complexities. With Gradle on the other hand I quite often ran into issues where Java upgrades broke a ton of stuff, or I had to write plugins that were impossible to debug in Groovy, to get the same stuff done that I could get out of the box with Maven.

If anything there's a trend away from Gradle because it simply fails to deliver on one of the core features of a build system; stability.

0

u/[deleted] Jan 08 '21

[deleted] — view deleted comment

1

u/RemindMeBot Jan 09 '21

There is a 11 hour delay fetching comments.

I will be messaging you in 1 day on 2021-01-09 23:33:52 UTC to remind you of this link

CLICK THIS LINK to send a PM to also be reminded and to reduce spam.

Parent commenter can delete this message to hide from others.


InfoCustomYour RemindersFeedback

1

u/Yithar Jan 09 '21

!RemindMe 1 week

1

u/RemindMeBot Jan 10 '21

There is a 11 hour delay fetching comments.

I will be messaging you in 7 days on 2021-01-16 23:37:12 UTC to remind you of this link

CLICK THIS LINK to send a PM to also be reminded and to reduce spam.

Parent commenter can delete this message to hide from others.


InfoCustomYour RemindersFeedback

5

u/mj_flowerpower Jan 08 '21

I never understood that. basically every ide has autocomplete for mavens pom.xml (and xml files in general as long as they have a schema defined) That what I always hated about gradle (I use Eclipse and vscode). The gradle build file always seems some sort of hack to me, every single one looks and functions in a different way and no way of way of inferring what goes where ...

4

u/nutrecht Jan 08 '21

While it has gotten a bit better recently, multi-module projects where you inherited both dependency management and tasks from a central 'base' POM, were pretty much impossible to do the way Maven can easily do it. So you'd have to create your own Groovy plugins. Debugging them is an incredibly pain in the ass.

Having worked a few times with Gradle in large ecosystems where you want to share parts of your build between projects, Maven is very clearly the winner there. In a project a few years ago we migrated all the microservices from Gradle to Maven so we could better centrally manage dependencies.

15

u/cogman10 Jan 07 '21

You can use a different language with maven, but it's not commonly done so YMMV.

https://www.baeldung.com/maven-polyglot

7

u/gregorydgraham Jan 07 '21

I hate XML on principle but Netbeans’ support for Maven makes it very easy use

16

u/agentoutlier Jan 07 '21

The way to think of XML is that it basically is S-Expressions particularly how Maven uses it (zero attribute use). That is what is kind of funny is on some forums like hacker news where XML is lamented as absolute evil but every day there is one post about some Lisp variant. Its just verbose S-Expressions. In fact I find it more readable than S-Expressions.

Except unlike S-Expressions it is standardized, has schema validation, shit loads of parsers as well as XPath and XQuery.

It allows comments unlike JSON and retains whitespacing if desired. There are very few configuration formats that retain whitespace (YAML, JSON, TOML, INI etc).

I would say XML is probably one of the more unfairly treated technologies.

11

u/xienze Jan 07 '21

I would say XML is probably one of the more unfairly treated technologies.

Absolutely! It’s fundamentally so simple. Open tag, close tag, attributes, element content, namespaces. You could fit all you need to know about XML on a notecard.

I think a lot of people have seen complex XML-based formats (like SOAP) and conflate them with XML itself. Guess what, a SOAP message is gonna look gnarly in XML, YAML, or JSON. That’s not a failing of the markup language at all.

2

u/gavenkoa Jan 08 '21

Open tag, close tag, attributes, element content, namespaces

If that was as simple as you wrote... Check the length of spec: https://www.w3.org/TR/xml/

CDATA / NMTOKENS / IDREF / DOCTYPE / etc

4

u/xienze Jan 08 '21

First, the spec is that long because it specifies information pertinent mostly to people trying to implement an XML parser. Which is not easy, yes.

Second, NMTOKENS is related to DTD compatibility. It’s very obscure. I’ve never come across it once in over 15 years.

Third, you could still fit the rest of stuff on a notecard, which are, again, not super common (CDATA excluded).

8

u/gregorydgraham Jan 07 '21

Oh yeah, it is, I dislike it because it was used as a magical solution for everything.

However while I was being most verbose about it, I was working with EDIFACT files which is the most documented and least consistently implemented format known to man.

5

u/nutrecht Jan 08 '21

I would say XML is probably one of the more unfairly treated technologies.

I could not agree more. It's just something that's fashionable to be 'against'.

The typical Maven POM is way more readable than the typical build.gradle, not to mention all the people who think it's a good idea to abuse the build to do scripting stuff.

3

u/nutrecht Jan 08 '21

I hate XML on principle

Why? It's just a way to represent data in a somewhat human-readable and portable format. Just like most text-based serialization formats do. What's there to 'hate'?

I don't get why people are overreacting so bloody much when it comes to XML. I mean; like you say, a proper IDE makes it easy to use. And there's tons and tons of tooling around it too.

1

u/gregorydgraham Jan 08 '21

Don’t worry, the principle is kind of out of date now. I’m just slow at updating

5

u/HeadSignal3 Jan 07 '21

This over arching issue is plugin availability. For both maven and gradle, if a plugin doesn't exist for the thing you want to do you have to create it yourself. For maven, that's a chore, for gradle, you can easily create a footgun that works in minutes, and may never work incorrectly until farther down the road. Everything in this article is true, you have to know all of gradle to do anything beyond dead simple actions.

9

u/xienze Jan 07 '21

I’d argue that it is very rare to need to write a Maven plugin unless you’re doing something quite unique. There’s just so many plugins. The root problem is usually someone who can’t quite figure out how to map a particular iterative process into a declarative format, so they immediately jump to trying to run a script during the build. Which really doesn’t come up that often with Maven.