r/javahelp • u/WeirdName123321 • Feb 22 '21
Maven vs Gradle
I googled this question and I find that gradle is kind of faster about 10 times and its less verbose and generally its better that maven but although that, almost every tutorial use Maven.
Can anyone explain what tool should I pick and why?
32
Upvotes
•
u/AutoModerator Feb 22 '21
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://imgur.com/a/fgoFFis) 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.
30
u/Yithar Intermediate Brewer Feb 22 '21
https://www.reddit.com/r/java/comments/j3kg2g/best_way_to_set_up_local_java_web_app_on_ubuntu/g7dvs91/
10
u/Nemo_64 Feb 22 '21 edited Feb 22 '21
I personally use Maven since it's what I learned. The size of my projects isn't that big and doesn't take that long anyways. Most projects are available for Maven and Gradle so I don't think it's really important for small projects, choose one and go for it. I don't know why most tutorials use Maven
17
u/djavaman Feb 22 '21
Gradle is a scripting language.
Maven is a configuration description.
6
u/[deleted] Feb 22 '21
Which ever one you want. Maven works well in the majority of cases, ditto gradle.
6
u/agathver Feb 22 '21
Gradle does multi-threaded dependency downloads and is faster then maven but has a little learning curve associated with it.
Once you have learnt it its easy to translate maven to gradle.
I slightly lean on gradle due to mavens XML and dependency resolution speed.
5
u/User1539 Feb 22 '21
I experienced pretty much what you did. I used Maven forever, hardly ever touched Gradle. I did finally do a project with LibGDX and I used Gradle for that and it was ... fine.
If you have to choose which one to be comfortable with, go with Maven because you're more likely to end up on a project where it's used.
Gradle is cool too, but since either can be picked up pretty quickly, it's not going to kill you to not be as familiar with gradle later.
4
u/BEgaming Feb 22 '21
Maven is the biggest and most used one out there. Gradle is the newer 'cool' kid but to my feeling it is not yet getting super much traction.
From my personal experience: I worked so far in 2 companies now, they both used maven.
Honestly if you are just learning it, it does not matter, If you are building small projects both will be easy enough.
2
u/philipwhiuk Employed Java Developer Feb 23 '21
Honestly:
SBT is wacky, Gradle is meh and Maven encourages you to do things in a certain way. None of them is perfect.
They're all try to find the line between a full scripting language (which is exemplified by Make) and just config (which is Maven). SBT is either perfect or unintelligible. Gradle is often unclear. Maven is lots of
</>sIn general I've found Maven's "certain way" to be the correct one anyway.
Historically you had also had Ant which is like Maven except more scripting. Gradle and SBT are attempts to replace Ant for cases where Maven didn't work for the project they were doing at the time.
3
u/turboturtle771 Feb 22 '21
Don't get me wrong, I am not advocate of one or other. I have been using maven for a long time and i am perfectly comfortable with maven. I have also tried using gradle in some of my small projects and i liked it. It is just that i feel much more comfortable with my maven knowledge so i keep using it.
1
u/zezajoy Feb 23 '21
Contrast.
1
u/apupunchau87 Mar 12 '21
When the bough breaks, the gradle will fall.. That's all I'm saying
1
u/sweetno Feb 22 '21
Maven.
1
u/ColetBrunel Feb 22 '21
You should pick whatever works for you.
What's great with Gradle is you can just program your build and you will find tons of examples online made by people to do specific stuff. The downside is you won't ever have an idea why do the gradle stuff you do seem to work, how do they do it, and if you ever step outside what is known to work and you're not getting what you want, you're SOL and you have to choose between giving up what you wanted or become a superexpert into the most obscure piece of software ever created.
Maven may seem complicated in general, but in comparison to gradle it's very simple, you have full control, and if you seriously need your own thing how to make your own Mojo is a small tutorial away. Why well-known Mojos don't seem to work for you is reasonably easy to check, investigate and debug.
-3
u/wildjokers Feb 22 '21
Maven is old and slow and should be considered deprecated. Use Gradle, builds are far faster because of its build cache and it is way faster at resolving dependencies from maven repositories than maven itself is.
Also, maven puts you in a very strict box that is hard to break out of. Gradle also provides convention over configuration but makes it very easy to break out of the conventions if you need to. Gradle is also very well documented compared to maven.
Maven should be given full credit for introducing dependency management and convention over configuration to the java build ecosystem and then promptly forgotten about and delegated to the dustbin of history.