szjug / szjug.github.io

Shenzhen(China) Java User Group 深圳Java用户组
http://szjug.github.io/
5 stars 8 forks source link

Gradle vs Maven #30

Open paulvi opened 7 years ago

paulvi commented 7 years ago

http://www.gradle.org/ vs https://maven.apache.org/

Maven started in 2004 to address Ant drawbacks, starting from scratches. Gradle started in 2014 as tool to build Groovy project, and adopting Maven default, supported ant, Ivy, then Android, then non JVM languages like C/C++ Latest 3.3 vs 3.3.9

Wikipedia is outdated https://en.wikipedia.org/wiki/Gradle vs https://en.wikipedia.org/wiki/Apache_Maven

Polyglot: Gradle Kotlin script .gradle.kts

wrapper is now also in Maven, check Spring Boot Initializer start.spring.io

Actually Gradle was started under SpringSource

When Google adopted Gradle for Android, that was a big break-though for Gradle (and also hit to Eclipse, when new Android Studio became IDEA CE-based)

Spring-framework is using Gradle, but Spring Boot is using Maven

If you want to do Spring development without no xml at all, then the Maven pom.xml is the last mile. Unless you go experimenting with Maven Polyglot. The problem of Maven Polyglot: "too many languages" and "Who needs this?"

Recommendations

What to use?

If you use Maven, don't hurry to switch to Gradle. If you still use Ant - you are dying, Gradle was before showing how it is easy to use Gradle over ant, but now deprecating and removing. (Would usage may be 1-5%). So what to use? If you have Android development, you may want to have common build tool - Gradle. If you are having many many modules (with nexus server) Maven is better, but gradle is catching up in 3.x Use Maven for Spring Boot (until Pivotal change default on it site)

Maven is declarative, straight forward to read. Gradle is more like development.

What to learn?

First Maven, then mostly Gradle. You can stay with Maven that is more stable, you may go with Gradle that is evolving quicker () and used with Android.

Links