Skip to content

Commit

Permalink
fix(deps): Align versions of transitive dependencies with Grails spec…
Browse files Browse the repository at this point in the history
…ified versions (#13860)

Ensure consistent versions of `spring-core`, `spring-jcl`, `spring-orm`, `snakeyaml`, `tomcat-jdbc` and `tomcat-jul` across all transitive dependencies. This resolves potential version conflicts caused by different versions being pulled in by other dependencies.

Closes #13856
  • Loading branch information
matrei authored Nov 19, 2024
1 parent 50fc30a commit 0870a69
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -232,20 +232,30 @@ allprojects {
}
}

configurations {
all {
resolutionStrategy {
def cacheHours = isCiBuild ? 0 : 24
cacheDynamicVersionsFor cacheHours, 'hours'
cacheChangingModulesFor cacheHours, 'hours'
eachDependency { DependencyResolveDetails details ->
//specifying a fixed version for all libraries with 'org.gradle' group
if (details.requested.group == 'org.codehaus.groovy') {
details.useVersion groovyVersion
}
if (details.requested.group == "org.spockframework") {
details.useVersion(spockVersion)
}
configurations.configureEach {
resolutionStrategy {
def cacheHours = isCiBuild ? 0 : 24
cacheDynamicVersionsFor cacheHours, 'hours'
cacheChangingModulesFor cacheHours, 'hours'

// Align versions of transitive dependencies with the version we are using
eachDependency { DependencyResolveDetails details ->
def forcedSpringLibraryUpgrades = ['spring-core', 'spring-jcl', 'spring.orm']
def forcedTomcatLibraryUpgrades = ['tomcat-jdbc', 'tomcat-juli']
if (details.requested.group == 'org.codehaus.groovy') {
details.useVersion(groovyVersion)
}
if (details.requested.group == 'org.spockframework') {
details.useVersion(spockVersion)
}
if (details.requested.group == 'org.springframework' && details.requested.name in forcedSpringLibraryUpgrades) {
details.useVersion(springVersion)
}
if (details.requested.group == 'org.yaml' && details.requested.name == 'snakeyaml') {
details.useVersion(snakeyamlVersion)
}
if (details.requested.group == 'org.apache.tomcat' && details.requested.name in forcedTomcatLibraryUpgrades) {
details.useVersion(tomcatVersion)
}
}
}
Expand Down

0 comments on commit 0870a69

Please sign in to comment.