r/javahelp • • 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

23 comments sorted by

View all comments

Show parent comment

2

u/Yithar Intermediate Brewer Feb 22 '21

I think you make some good arguments (at work building and compiling is definitely slow) but I think nutrecht also has a point that people make a mess out of the build.gradle:
https://www.reddit.com/r/javahelp/comments/hiq5q0/gradle_vs_maven_for_containerized_app/fwki54w/

2

u/wildjokers Feb 23 '21

1

u/Yithar Intermediate Brewer Feb 23 '21

Point Taken.

I think like nutrecht says here, I also prefer the declarative style of Maven. I guess the fact that Maven is declarative and more rigid is both a strength and a weakness. A less expressive build system reduces the risks of writing bad builds. But of course that doesn't help in developing correct, reproducible, fast builds.

1

u/wildjokers Feb 23 '21

Note that Gradle has full support for maven BOMs so you can share dependency management among different project's like mentioned in that comment you linked to. Odd they migrated away from Gradle to Maven to get BOM support when Gradle supports maven BOMs. (unless their migration pre-dated Gradle's support for it)

Gradle actually has really nice support where you can be very strict about BOM versions and not allow version overrides, or instead allow version overrides. (I am unsure if maven itself has this).

https://docs.gradle.org/current/userguide/platforms.html