diff --git a/gradle/published-java-module.gradle b/gradle/published-java-module.gradle index 4ba5d5f4ae31..74f8c0a52642 100644 --- a/gradle/published-java-module.gradle +++ b/gradle/published-java-module.gradle @@ -24,29 +24,29 @@ dependencies { javadocSources sourceSets.main.allJava } +java { + // Configure the Java "software component" to include javadoc and sources jars in addition to the classes jar. + // Ultimately, this component is what makes up the publication for this project. + withJavadocJar() + withSourcesJar() +} + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Publishing -publishing { - publications { - // main publication - publishedArtifacts { - // Add the Java component to the main publication - from components.java - } +var publishingExtension = project.getExtensions().getByType(PublishingExtension) as PublishingExtension +publishingExtension.publications { + // main publication + publishedArtifacts { + // Add the Java component to the main publication + from components.java } } -java { - // include javadoc and sources jar in the Java component - // - classes jar included by default - withJavadocJar() - withSourcesJar() -} - -// signing +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Signing // create a `signPublications` "grouping" task which will execute all Sign tasks def signPublicationsTask = tasks.register('signPublications')