diff --git a/buildSrc/src/main/java/org/springframework/security/kerberos/gradle/SpringMavenPlugin.java b/buildSrc/src/main/java/org/springframework/security/kerberos/gradle/SpringMavenPlugin.java index 3234516..637cd60 100644 --- a/buildSrc/src/main/java/org/springframework/security/kerberos/gradle/SpringMavenPlugin.java +++ b/buildSrc/src/main/java/org/springframework/security/kerberos/gradle/SpringMavenPlugin.java @@ -22,7 +22,6 @@ import org.gradle.api.Project; import org.gradle.api.attributes.Usage; import org.gradle.api.component.AdhocComponentWithVariants; -import org.gradle.api.component.ConfigurationVariantDetails; import org.gradle.api.plugins.JavaPlugin; import org.gradle.api.plugins.JavaPluginExtension; import org.gradle.api.plugins.PluginManager; @@ -66,35 +65,15 @@ private void customizeMavenPublication(MavenPublication publication, Project pro customizePom(publication.getPom(), project); project.getPlugins().withType(JavaPlugin.class) .all((javaPlugin) -> customizeJavaMavenPublication(publication, project)); - suppressMavenOptionalFeatureWarnings(publication); } private void customizeJavaMavenPublication(MavenPublication publication, Project project) { - addMavenOptionalFeature(project); publication.versionMapping((strategy) -> strategy.usage(Usage.JAVA_API, (mappingStrategy) -> mappingStrategy .fromResolutionOf(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME))); publication.versionMapping( (strategy) -> strategy.usage(Usage.JAVA_RUNTIME, VariantVersionMappingStrategy::fromResolutionResult)); } - private void suppressMavenOptionalFeatureWarnings(MavenPublication publication) { - publication.suppressPomMetadataWarningsFor("mavenOptionalApiElements"); - publication.suppressPomMetadataWarningsFor("mavenOptionalRuntimeElements"); - } - - private void addMavenOptionalFeature(Project project) { - JavaPluginExtension extension = project.getExtensions().getByType(JavaPluginExtension.class); - extension.registerFeature("mavenOptional", - (feature) -> feature.usingSourceSet(extension.getSourceSets().getByName("main"))); - AdhocComponentWithVariants javaComponent = (AdhocComponentWithVariants) project.getComponents() - .findByName("java"); - if (javaComponent != null) { - javaComponent.addVariantsFromConfiguration( - project.getConfigurations().findByName("mavenOptionalRuntimeElements"), - ConfigurationVariantDetails::mapToOptional); - } - } - private void customizePom(MavenPom pom, Project project) { pom.getUrl().set("https://github.com/spring-projects/spring-security-kerberos"); pom.getName().set(project.provider(project::getName));