Slackbot
10/26/2023, 1:56 AMBen Madore
10/26/2023, 2:04 AMproject.configurations.all {
resolutionStrategy.dependencySubstitution {
all {
requested.let {
if (it is ModuleComponentSelector && it.group == "org.codehaus.groovy") {
useTarget("org.apache.groovy:${it.module}:4.0.0")
}
}
}
}
}Vampire
10/26/2023, 6:52 AMBen Madore
10/26/2023, 3:03 PMBen Madore
10/26/2023, 3:04 PMVampire
10/26/2023, 3:09 PMorg.apache.groovy, even if only org.codehaus.groovy is on the dependency tree. But if you request version 3.x of codehaus and then substitute by apache, no version 3.x is found.
If you would have codehaus and apache both on the dependency tree you would actually get a capabililty conflict, as apache declares that it also provides the codehaus capability and you could then use a capability conflict resolution rule to use the highest version of the requested ones.
For what you want, you indeed use a dependency substitution rule as you also want to change the version. The question is just whether you always want to use 4.0.0 if only codehaus is requested, or if you want to use latest 4.x or latest released or a specific later 4.x.Ben Madore
10/26/2023, 3:17 PMspring-boot-dependencies as a platform, which in turn imports the groovy bom.
For boot 3.1.5 the groovy-bom imported is 4.0.15. I assumed that by using the first 4.0.0 version, it’d allow gradle to resolve the dependencies and almost certainly choose the latest version as imported from bom. I’m seeing this behavior when i apply the plugin, say i have a transitive in my app’s classpath. It ends up doing this:
+--- com.myapp:some-library:20230420.1832
| +--- org.codehaus.groovy:groovy:3.0.14 -> org.apache.groovy:groovy:4.0.15 (*)Vampire
10/26/2023, 3:18 PM