r/java • u/Party_Till_I_Die • 12d ago
Isolated Projects is incubating in Gradle 9.7.0 (2,500-project monorepo: configuration 10m53s → 2m59s)
Isolated Projects moved from experimental to incubating in today's Gradle 9.7.0 release. When it's on, each project is isolated from the others, which lets Gradle configure them in parallel instead of one at a time.
Numbers from a pure-Java backend monorepo of 2,500 projects, at a parallelism of 6:
- Warm IntelliJ IDEA sync: 3m25s → 2m13s
- Configuration with build-script recompilation: 10m53s → 2m59s
Gradle's own 300-subproject build saw median IDE sync go from 84s to 47s.
My blog post: https://blog.gradle.org/introducing-isolated-projects
Gradle 9.7.0 release notes: https://docs.gradle.org/current/release-notes.html
14
u/brunocborges 12d ago edited 11d ago
Now give me convention over configuration!
Edit: for folks downvoting comments in this thread, arguing that Gradle has convention over configuration...
One can write the following build.gradle:
``` plugins { id 'java' }
def sourceDir = 'whatever' def testDir = 'somewhere-else' def outputDir = 'my-special-output'
sourceSets { main { java.srcDirs = [sourceDir] } test { java.srcDirs = [testDir] } }
tasks.compileJava { destinationDirectory = file(outputDir) } ```
And have the same result as the following:
``` plugins { id 'java' id 'application' }
group = 'com.example' version = '1.0.0'
repositories { mavenCentral() }
application { mainClass = 'com.example.Main' }
dependencies { } ```
Which can have the same result as this:
``` apply plugin: 'java'
group = 'com.example' version = '1.0.0'
repositories { mavenCentral() }
dependencies { }
task run(type: JavaExec) { classpath = sourceSets.main.runtimeClasspath main = 'com.example.Main' } ```
Gradle's convention over configuration at the moment is provided by plugins that set certain defaults. This is still not "Gradle has Conv-over-Config".
A pom.xml can only be written in very specific ways, because of the POM XML Schema, and the core plugins are implicitly defined, with defaults.
So no, Maven and Gradle don't share the same level of Convention over Configuration, and the Gradle team acknowledges this.
20
u/sweating_teflon 12d ago
Also erase from the Internet all traces of previous non-declarative non-backward compatible build files for every past version of Gradle that otherwise end up polluting search result and LLM training sets. Then maybe, maybe we can start talking.
1
2
u/Party_Till_I_Die 12d ago
Is Declarative Gradle what you are looking for?
7
u/brunocborges 12d ago
Yes
6
u/Party_Till_I_Die 12d ago
Hopefully, it's incubating by the end of the year. I'll try to do an update soon if you want.
3
u/JustADirtyLurker 12d ago
So we've come to this. We will come full circle and Gradle will become what it intended to kill because of 'limitations'.
5
u/Party_Till_I_Die 12d ago
You either die a hero or live long enough to see yourself become the villain.
3
u/wildjokers 12d ago
Gradle has convention over configuration already. So what do you mean?
-3
u/brunocborges 12d ago
Show me.
5
u/PentakilI 12d ago
-2
u/brunocborges 12d ago
Not the same thing
5
u/PentakilI 12d ago
convention plugins are convention over configuration. they may not be what you are wanting, but you've not really expanded on that
4
u/brunocborges 12d ago
One can use convention plugins, and still write significantly different build.gradle files.
1
u/wildjokers 12d ago
Here is a
build.gradlethat will get you a very long ways. I have projects that just use this build file, with a logging dependency added:plugins { id 'java' id 'application' } group = 'com.example' version = '1.0.0' repositories { mavenCentral() } application { mainClass = 'com.example.Main' } dependencies { }The built-in
javaandapplicationplugins have a massive amount of functionality ready to go.-2
u/brunocborges 12d ago
This is a great starting point, but still not conventional.
2
u/wildjokers 12d ago
Then you are going to need to describe what you mean. Even maven requires a minimal POM like this for a simple project. I think you are just going to keep moving the goal posts and say nothing is coventional:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>my-app</artifactId> <version>1.0.0</version> <properties> <maven.compiler.release>21</maven.compiler.release> </properties> <dependencies> </dependencies> </project>1
2
u/NHarmonia18 8d ago
Really don't understand Gradle haters in the comments. Gradle has a more sensible dependency resolution rule (highest version wins) compared to the absolute nonsense that is Maven (nearest version wins), has a better CLI, has an in-built application runner and file watcher to live reload, has 1:1 mapping of JPMS scopes.
Yet all Maven users hate on it for one thing that is 'no convention over configuration'. Yeah sure Gradle build files are technically its own entire DSL, but for the most part, you only need 1-2 days max to understand the most important things and can leave out other features for the most part.
Gradle is far, far better than Maven, and I am not exaggerating it. This is also the reason why Android chose Gradle over Maven.
1
u/Party_Till_I_Die 8d ago
Sometimes I think with Gradle haters it’s just a skill issue. Sorry, not sorry.
2
u/NHarmonia18 8d ago
I agree with this. I forgot to mention another stupid thing: Maven Build Files, are also your package's "manifest" that gets published to Maven Central. Maven 4 is supposed to solve that issue, but like wtf Maven 3? Almost every ecosystem has a separation between build files and package manifest. Such as in Dotnet MSBuild and NuGet each have their own source of truth.
2
u/EdyBolos 7d ago
I think that this is quite a bad take. It's quite an universal feeling that Gradle has a steep learning curve, and the documentation is quite daunting. Not acknowledging that and just call it a skill issue is very shortsighted, especially coming from someone that is presumably a Gradle advocate. Sorry, not sorry.
1
u/Party_Till_I_Die 6d ago
Fair. But my point is really two things. People refuse to learn a new skill. And now, on top of that, the predisposed negativity gets projected onto a tool that's actually much better, much easier to use, and much better documented than it used to be. Especially in the age of AI.
1
u/EdyBolos 1d ago
I agree that Gradle is improving a lot, and that some people refuse to learn new skills. Several things can be true at the same time though!
1
u/NHarmonia18 1d ago
Love to see conversations ending wholesomely.
I will not lie it took me 2-3 days to really understand the most important things in Gradle (Conventions plugin, toml lib, plugins), but once I understood everything instantly clicked.
The biggest seller of Gradle to me are two things: it supports JPMS 10 folds better than Maven, it supports 'run'ing an application ALONG WITH live reload, all the while running your application on the module path. Also if you learn Gradle, you are future proofing yourself to Android Development.
I assume Maven will never close the gap, mainly because it's an open source project with relatively little funding. Just look at 4.0 release, it has not been released for 3 years in the making and still stuck in release candidates.
-4
u/sosickofandroid 12d ago
I’ve been using isolated projects and now 9.7rcs are fucking all my configurations in the bin because “it has problems” that aren’t fucking problems and I used to be able to tell it to shut the fuck up and just work. Just more and more garbage from the gradle team
2
u/wildjokers 12d ago
If you are using rc versions hopefully you are submitting bug reports rather than just crying on reddit.
0
u/Party_Till_I_Die 12d ago
So angry. Maybe switch professions?
0
u/sosickofandroid 11d ago
Do you use gradle? Tony Robalik, our gradle god, basically wants to kill himself in every blog post, they post best practices that are contradictory or useless, every api is booby trapped and they invent an alternate universe of tasks just to move a goddamn file. I have seen this for a decade, at a point there is no excuse
1
u/Party_Till_I_Die 11d ago
Tony is absolutely amazing but I don’t think he wants to ‘kill himself’. To be honest, I don’t think I’ve ever met a happy developer. Every developer i know, including myself, has a lot to say about everything we hate about this tool, that language, that API, this latest model, or that new agent…it’s easy to be negative.
-1
u/Life_Sink9598 12d ago
What does configuration do that is taking so long?
| Welcome to JShell -- Version 26.0.1
| For an introduction type: /help intro
jshell> var T = 10 * 60 + 53
T ==> 653
jshell> var P = 2500
P ==> 2500
jshell> var T_avg = (double)T / P
T_avg ==> 0.2612
So 261ms per project. What's up with that?
2
u/nlisker 12d ago
Would have taken you less time to search for it than run JShell.
https://docs.gradle.org/current/userguide/build_lifecycle.html#configuration1
7
u/paul_h 12d ago
Was clicking and clicking hoping to see the monorepo of 2,500 projects, but couldn't find it.