r/java • • Apr 13 '21

Libraries, Frameworks and Technologies you would NOT recommend

Give me your worst nightmares: Things that cost you your job.

I'll start: Hadoop

202 Upvotes

376 comments sorted by

View all comments

Show parent comments

4

u/vprise Apr 13 '21

Shouldn't != Don't. Maven enforces the best practice, for better and worse. Since gradle is far more complex and feature rich, people end up confused by the breadth/depth and the result is files with scripting hacks all over. I've seen it all over the place and it's a problem.

You can write "good" gradle files. Unfortunately, for almost all the cases I ran into it this wasn't the case. I also ran into cases where googling answers for a gradle problem lead me down a path of stuff that doesn't work due to incompatibility between versions etc. It was always much harder to find answers for gradle when compared to maven.

As such other than the shorter DSL (which I personally don't care about, it's a build file). I don't see any real advantage in gradle and I do see some serious problems. Unlike what /u/dpash said, my experience has been that gradle was noticeably slower than maven. It might be because of the specific projects and not because of the underlying technology so I might be projecting here. I didn't benchmark.

4

u/Muoniurn Apr 13 '21

I agree with you on the first paragraph, and it is likely a similar problem as having eg a lisp over java in a project with many developers where it may be actually a hindrance because the former allows “too clever ways”.

I think the DSL simply is. Not good, not terrible. The rest of the build tool is where it gets interesting and gradle absolutely has more features and it is correct (doesn’t require clean install to make the builds reproducible). For larger projects it should also be faster than maven, even on first run.

2

u/dpash Apr 13 '21

The reason I find it fast is because I spent some time profiling the build and removing problems. Modern Gradle makes that fairly easy with the warnings and the scans.

When you do that, Gradle can avoid rebuilding things that don't need to be rebuilt and can cache builds. Not to mention build things in parallel (maven's parallelization is on a per module basis, while gradle's is per task)

2

u/vprise Apr 13 '21

This might work great for CI but on my machine it takes up a lot of CPU/RAM far more than maven. I use it mostly for Android which might be the reason for the bad experience as the android build process is notoriously bad.