diff --git a/gradle-versions-plugin/src/main/kotlin/com/github/benmanes/gradle/versions/updates/Resolver.kt b/gradle-versions-plugin/src/main/kotlin/com/github/benmanes/gradle/versions/updates/Resolver.kt index e792c676..cb03b578 100644 --- a/gradle-versions-plugin/src/main/kotlin/com/github/benmanes/gradle/versions/updates/Resolver.kt +++ b/gradle-versions-plugin/src/main/kotlin/com/github/benmanes/gradle/versions/updates/Resolver.kt @@ -25,6 +25,7 @@ import org.gradle.api.artifacts.repositories.MavenArtifactRepository import org.gradle.api.artifacts.result.ResolvedArtifactResult import org.gradle.api.attributes.Attribute import org.gradle.api.attributes.HasConfigurableAttributes +import org.gradle.api.attributes.java.TargetJvmVersion; import org.gradle.api.internal.artifacts.DefaultModuleVersionIdentifier import org.gradle.api.internal.artifacts.dependencies.DefaultProjectDependencyConstraint import org.gradle.api.specs.Specs.SATISFIES_ALL @@ -143,6 +144,8 @@ class Resolver( addRevisionFilter(copy, revision) addAttributes(copy, configuration) addCustomResolutionStrategy(copy, currentCoordinates) + + disableAutoTargetJvm(copy) return copy } @@ -192,6 +195,12 @@ class Resolver( return nonTransitiveDependency } + private fun disableAutoTargetJvm(configuration: Configuration) { + // Disable the auto target jvm for the configuration + // https://github.com/ben-manes/gradle-versions-plugin/issues/727#issuecomment-1427132589 + configuration.attributes.attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, Integer.MAX_VALUE); + } + /** Adds the attributes from the source to the target. */ private fun addAttributes( target: HasConfigurableAttributes<*>, @@ -256,6 +265,7 @@ class Resolver( val coordinates = hashMapOf() val copy = configuration.copyRecursive().setTransitive(transitive) + disableAutoTargetJvm(copy) val lenient = copy.resolvedConfiguration.lenientConfiguration val resolved = lenient.getFirstLevelModuleDependencies(SATISFIES_ALL) diff --git a/gradle.properties b/gradle.properties index dce12a0f..da0df19c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ GROUP=com.github.ben-manes -VERSION_NAME=0.45.0 +VERSION_NAME=0.46.0 POM_INCEPTION_YEAR=2012 POM_PACKAGING=jar