3 ms·
In Maven, the only way to share build logic is through a parent POM. Even if only four modules (out of 10) need to share some build logic, the only way is to ge
by rdsubhas 10y ago
In Maven, the only way to share build logic is through a parent POM. Even if only four modules (out of 10) need to share some build logic, the only way is to get it into the parent POM.
So in most maven projects, the parent POM is a kitchen sink.
Gradle allows to create separate shared ".gradle" files that individual projects can import. This is push vs pull, and makes a world of a difference. So we have one shared "java_service.gradle" and one shared "java_library.gradle", and our submodules just do "apply from: <shared-build-file>".
Our root "build.gradle" is intentionally empty with a BIG warning never to add any shared logic in it.
This is just one of the reasons. You also see that with gradle, you can do "gradle test" on one submodule and it will compile all other dependencies but run tests only on this module. Maven, on the other hand, if you do "mvn test --pl <module> --also-make", will compile and test ALL related modules.
I can keep writing a long list of other stuff. But in the end, Maven is a "Project Management Tool" that tried to do a hundred things, and gets nothing right. Gradle is a proper good build tool.
- lenkite 10y agoThis is not correct. One can import POM's in maven since maven 3.0.x (which is several years old). You are certainly not 'forced' to have build logic in only parent POM's.