Skip to content

Commit

Permalink
Fix SigningPlugin property is not a file error
Browse files Browse the repository at this point in the history
Issue gh-208
  • Loading branch information
rwinch committed May 30, 2024
1 parent 53671cb commit 3759aab
Showing 1 changed file with 0 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 3759aab

Please sign in to comment.