diff --git a/src/main/java/io/spring/gradle/dependencymanagement/internal/maven/PlatformCategoryAttributeConfigurer.java b/src/main/java/io/spring/gradle/dependencymanagement/internal/maven/PlatformCategoryAttributeConfigurer.java index 83377c0..6835a64 100644 --- a/src/main/java/io/spring/gradle/dependencymanagement/internal/maven/PlatformCategoryAttributeConfigurer.java +++ b/src/main/java/io/spring/gradle/dependencymanagement/internal/maven/PlatformCategoryAttributeConfigurer.java @@ -16,20 +16,19 @@ package io.spring.gradle.dependencymanagement.internal.maven; -import java.lang.reflect.Method; - import org.gradle.api.Action; import org.gradle.api.artifacts.Dependency; import org.gradle.api.artifacts.ModuleDependency; +import org.gradle.api.attributes.Attribute; +import org.gradle.api.attributes.AttributeContainer; +import org.gradle.api.attributes.Category; import org.gradle.util.GradleVersion; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Support class for configuring the {@code org.gradle.category} attribute on a - * {@link ModuleDependency} with a value of {@code platform}. The configuration is done - * reflectively as the necessary APIs are not available in the version of Gradle against - * which the code is compiled. + * {@link ModuleDependency} with a value of {@code platform}. *
* Configuring the attribute works around a problem in Gradle 5 that prevents resolution * of a pom for which Gradle 5 has been used to publish Gradle module metadata. The @@ -46,22 +45,12 @@ void configureCategoryAttribute(Dependency dependency) { return; } try { - Method attributes = dependency.getClass().getMethod("attributes", Action.class); - attributes.invoke(dependency, new Action