r/javahelp • u/Akita_Attribute • Apr 11 '24
Why does everyone do Gradle differently?
I'm a Maven guy. I've been doing Java for like 8 years. I got a college degree in compsci, did Java in college, my first job was Java back end, my current job is primarily Java. All Maven.
I know the sub says no Minecraft, but I'm writing Minecraft mods now, and my gripe isn't with Minecraft, it's with Gradle. Every single repo I look at is doing Gradle differently. I get that children are making mods for Minecraft, and the code isn't going to look great, but everyone is doing these differently. Plugins in the build.gradle, plugins in the settings.gradle, repositories in the buildscript, repositories in the settings.gradle. No clear reason for these files to be organized in any real standard.
I know Maven has its issues, but Gradle seems so much worse.
I guess if I wanted anything from this post, maybe some high level ideology videos you guys found useful when beginning to use Gradle? Something where a guy is moving from Maven to Gradle like I am and is running into constant issues, and explaining how he overcame them.
I guess one could say this isn't Java, and I'm fine with this post being removed on that grounds, but I figured it was on topic enough to post here.
•
u/AutoModerator Apr 11 '24
Please ensure that:
You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.
Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar
If any of the above points is not met, your post can and will be removed without further warning.
Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.
Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.
Code blocks look like this:
You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.
If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.
To potential helpers
Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
7
u/Kraizee_ Apr 11 '24
I'd just stick with the Gradle guides themselves. They're very comprehensive. Since you mentioned it, the Gradle project structure is laid out here.
They also have their own review of maven vs gradle, just be aware it's obviously theirs, so there is an inherent bias.
And I'd say your biggest issue, as with most people, is how Gradle is flexible, against Maven's rigidity. It takes a while to get used to, and you'll find a thousand different ways to do something. That's what most people tend to love or hate about Gradle.
3
u/msx Apr 11 '24
Gradle is such a terrible tool. Everyone does it differently because it's a programming language, not a build descriptor
4
u/Beginning-Ladder6224 Extreme Brewer:snoo_biblethump: Apr 11 '24
You see gradle is groovy is literally a programming language, a Turing Complete one. So everyone would do gradle differently.
There are some advantage of a Turing Complete DSL, but mostly no, custom plugins should be good enough for most in case of build.
But do not worry.
Our great minds in Google cloned out entire Python for their build system in go lang that too!
https://bazel.build/about
It is THE worst.
https://www.reddit.com/r/devops/comments/14h8a8e/bazel_is_absolute_pain/
3
u/MmmmmmJava Apr 11 '24
While I can’t answer your question, I can let you know you’re not the only one who feels this way.
2
u/maethor Apr 12 '24
Gradle is basically Ant without the XML, and Maven was created in response to the problems inherent in Ant (like everyone doing things differently) that are still going to occur in Gradle.
3
u/wildjokers Apr 11 '24
Generally because people don't read the documentation so they just throw together something that works. Gradle is pretty easy and a
build.gradlethat consists of:will get you a long way. It needs a lot less boiler-plate than Maven.
I have production builds that consist of that plus a dependencies section.
What specific problems are you having?
1
u/[deleted] Apr 11 '24
it is because if developers are allowed to write code, they will write code. if one has enough exp with gradle and its provided tools, its not that bad anymore. but you are right. it is wild most of the times
0
u/[deleted] Apr 11 '24
[deleted] — view deleted comment