`predeclareDepsFromBuildscript` - Mutating configuration container for buildscript of root project has been deprecated.
Summary: Gradle shows a deprecation warning when Spotless is used in a multi-module build with:
spotless {
predeclareDepsFromBuildscript()
}
Warning: Mutating configuration container for buildscript of root project 'xy' using create(String) has been deprecated. This will fail with an error in Gradle 9.0.
Gradle: 8.12 Spotless: 7.0.1
Does spotlessPredeclare trigger this same behavior? Seems that Gradle has been moving away from the buildscript model in general, possible that we'll have to lose it.
If I leave out predeclareDepsFromBuildscript so that the dependencies are pulled from the root project, the deprecation warning does not show up. We are using the legacy behavior as a workaround, because the maven repository definition in the projects apply content filters. As the name of the configuration that spotless uses to download dependencies is dynamic, I cannot whitelist it.
Roger. So we either need to:
- figure out a way around the deprecation
- make the configuration names friendlier
Here is the relevant code, PRs welcome
https://github.com/diffplug/spotless/blob/f77aeadc249d0f1b7b87249c169bfb9b2d44bbb1/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GradleProvisioner.java#L103-L144
Why does it include a hashcode in the configuration name? Can there be multiple such configurations in the same project?
There can be multiple spotless configurations, yeah. But there is only one for each step. Easiest would be to change the name to be based on the maven coordinate of the first jar, could be with or without the version string.
spotless-com.google.googlejavaformat:google-java-format:1.25.2spotless-com.google.googlejavaformat:google-java-format
Could also remove the group, which would make it just
spotless-google-java-format
Which configuration naming convention would work best for you?
If we can leave out the version number from the name, that would be great. I don't have an opinion whether the group id should be included or not. Works both for me.