r/programming • u/sidcool1234 • Jan 16 '21
The problem with Gradle
https://www.bruceeckel.com/2021/01/02/the-problem-with-gradle/37
u/Prod_Is_For_Testing Jan 16 '21
Coming from .net, I don’t understand why the java build systems have to be so complicated (I also don’t understand why there isn’t one definitive choice, but that’s separate). It took me an entire day to figure out how to get a runnable jar with gradle. That’s ridiculous
15
u/shooshx Jan 17 '21
Have you ever looked at msbuild.exe build scripts? It's a horrific mess.
6
u/vattenpuss Jan 17 '21
Yeah, Visual Studio just hides all this from people. But it's still complicated, pasting a UI on top of the XML mess is not making it better per se but I guess it does mean you never have to make the choice yourself or learn how it works: https://docs.microsoft.com/en-us/visualstudio/msbuild/walkthrough-creating-an-msbuild-project-file-from-scratch?view=vs-2019
2
u/cat_in_the_wall Jan 18 '21
msbuild is god awful (i've had to make targets) but at least since the sdk style projects came out starting with core (and seem to be back compat with framework) i don't ever deal with msbuild directly, it's shimmed either through vs or the dotnet cli. they hide how the sausage these days and that is good.
16
u/MrDOS Jan 17 '21
I think it's largely due to the higher degree of modularity in the language tooling, at least historically. In .NET, a highly-modularized toolchain is a very new revelation; historically, everything you needed was in Visual Studio, and all aspects of the project were managed through Visual Studio's GUI. I'm quite sure a small majority of .NET developers have never bothered to open their build configuration files in a text editor. In contrast, while Java has always had defacto/dominant tools, they've been more piecemeal. Developers moved from Ant to Maven to Gradle for building, while they went (at a different pace, or maybe not at all) from Eclipse to IntelliJ for developing. That separation of tools led to more tinkering, more divergent opinions (“But I want to do it this way”), and, for better or worse, more flexible tools to meet the desires of as many developers as possible.
It's awful.
4
u/cat_in_the_wall Jan 18 '21
even with the advent of .net core and ms's realization that yes, programmers want parity at the command line, there is still the "one true way", aka "dotnet BLAH". so all the msbuild garbage that backs it all is still hidden unless you really want to go spelunking.
2
u/emotionalfescue Jan 17 '21
OK I'll bite. Why doesn't somebody port Ant to use JSON instead of XML?
15
u/badillustrations Jan 17 '21
The problem with ant isn't XML. You could make the file more concise with JSON, but that shouldn't be a significant factor in a build tool when there are much more significant differences.
5
u/MonokelPinguin Jan 17 '21
Ant is basically a Makefile in XML. This has all the downsides of Makefiles, where you need to reinvent (or copy and paste giant blocks) of build code. In my experiemce so far they are very rarely portable and instead rely on specific files being in the right places, usually how the developer set the machine up. At my old job I replaced a giant Ant script with a Gradle file a third of the size, because we just couldn't reasonably get it to work in CI and add unit test reports. Gradle does have issues, but Ant is much worse and needs much more effort and knowledge to do properly in my experience.
3
11
u/joschi83 Jan 16 '21
6
u/renatoathaydes Jan 16 '21
And the response from one of the Gradle team members: https://melix.github.io/blog/2021/01/the-problem-with-gradle.html
35
u/skywalkerze Jan 16 '21
The response is quite long and complex, for someone trying to contradict the point that Gradle is too complex.
For example, it takes issue with "you're not configuring but programming", and arrives at the conclusion "you're programming the configuration".
Sounds to me like Bruce is right but these people can't take criticism.
16
2
u/renatoathaydes Jan 17 '21
I am a satisfied Gradle user (if not a fan anymore), but even I agree with you!
Having to help my coworkers constantly as they have difficulties doing things in Gradle, and struggling myself with many issues even after almost a decade using it, I completely accept that Gradle is not as complex as it needs to be due to the nature of build systems, it's quite a lot more complex than that.
1
u/lolomfgkthxbai Jan 17 '21
That’s no surprise that Gradle has been successfully used to build software in various ecosystems: the JVM, where it’s born (with Java, Groovy, Scala in particular), but also native development (take a look at Nokee if you are interested), Go (Go Gradle), …
Anyone tried Go Gradle? Sounds like a square peg for a round hole.
1
u/joschi83 Jan 18 '21
And the response from one of the Gradle team members
I know, that's why I included it in my post. 😉
5
1
u/Tigermouthbear Jan 17 '21
I'd say the only real problem is performance, but that's to be expected with the amount of dependency management Gradle does. Other than that, I think this author is just complaining about how they had to put effort into learning it. Gradle IS basically another language, and it's pretty much necessary to learn when you're learning Java.
0
u/TheBestOpinion Jan 17 '21
I like Gradle. Writing gradle files aside, everytime I download something through pip, luarocks, cmake, maven, there is always something that breaks. It rarely ever happens when I use Gradle, Cargo, or npm
7
u/skywalkerze Jan 17 '21
My experience is exactly opposite:
Everytime I download something through gradle or npm, there is always something that breaks. It rarely ever happens when I use maven.
Android studio projects are especially difficult. Any change to a dependency is a gamble that might take 5 minutes or two days.
4
7
u/SaltyBarracuda4 Jan 17 '21
Gradle is the worst java build system, except for every other java build system.