Skip to content

Commit 8baf8b4

Browse files
Align requireUpperBoundDepsMatch to Maven requireUpperBoundDeps
Maven requireUpperBoundDeps checks that the version for each dependency resolved during a build, is equal to or higher than all transitive dependency declarations. It is not required for a resolved dependency to exactly match all transitive dependency declarations. As a proof-of-concept, this implementation uses Gradle's VersionNumber utility, which is deprecated and scheduled to be removed in Gradle 9. An alternative (or custom) version comparison utility should be used.
1 parent 4fa7f21 commit 8baf8b4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,9 +498,9 @@ def requireUpperBoundDepsMatch(Configuration conf, Project project) {
498498
version = ((ModuleComponentSelector) result.requested).version
499499
}
500500
String goldenVersion = golden[artifact]
501-
if (goldenVersion != version && "[$goldenVersion]" != version) {
501+
if (VersionNumber.parse(version) > VersionNumber.parse(goldenVersion)) {
502502
throw new RuntimeException(
503-
"Maven version skew: $artifact ($version != $goldenVersion) "
503+
"Maven version skew: $artifact ($version > $goldenVersion) "
504504
+ "Bad version dependency path: " + depAndParents.parents
505505
+ " Run './gradlew $project.path:dependencies --configuration $conf.name' "
506506
+ "to diagnose")

0 commit comments

Comments
 (0)