This message was deleted.
# community-support
s
This message was deleted.
b
i think i got it. ah, i think you must have a version, but i can set it to, say 4.0.0 and let regular version selection rules pick the version suggested by the bom this seems to work
Copy code
project.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")
                        }
                    }
                }
            }
        }
v
It's it only for when both are in the dependency tree, or also if there is only v3?
b
the latter
i know you can do module substitutions, but that only works if both show up in the classpath, in this case if ONLY groovy 3 is on the classpath (say as a transitive), i still wanna replace with 4
v
dependency substitution rule would work if you request a version that is also available in
org.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.
b
yeah, i’d ideally like to use the latest, but this is in a plugin, and only applies on our spring boot 3 apps - in those apps we always have imported
spring-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:
Copy code
+--- com.myapp:some-library:20230420.1832
|    +--- org.codehaus.groovy:groovy:3.0.14 -> org.apache.groovy:groovy:4.0.15 (*)
v
Probably, yeah
thank you 1