diff --git a/buildSrc/src/main/java/org/springframework/boot/build/DeployedPlugin.java b/buildSrc/src/main/java/org/springframework/boot/build/DeployedPlugin.java index a05ebcb29a..f0e1813877 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/DeployedPlugin.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/DeployedPlugin.java @@ -23,6 +23,7 @@ import org.gradle.api.plugins.JavaPlugin; import org.gradle.api.publish.PublishingExtension; import org.gradle.api.publish.maven.MavenPublication; import org.gradle.api.publish.maven.plugins.MavenPublishPlugin; +import org.gradle.api.tasks.bundling.Jar; /** * A plugin applied to a project that should be deployed. @@ -42,9 +43,14 @@ public class DeployedPlugin implements Plugin { project.getPlugins().apply(MavenRepositoryPlugin.class); PublishingExtension publishing = project.getExtensions().getByType(PublishingExtension.class); MavenPublication mavenPublication = publishing.getPublications().create("maven", MavenPublication.class); - project.getPlugins().withType(JavaPlugin.class) - .all((javaPlugin) -> project.getComponents().matching((component) -> component.getName().equals("java")) - .all((javaComponent) -> mavenPublication.from(javaComponent))); + project.afterEvaluate((evaluated) -> { + project.getPlugins().withType(JavaPlugin.class).all((javaPlugin) -> { + if (((Jar) project.getTasks().getByName(JavaPlugin.JAR_TASK_NAME)).isEnabled()) { + project.getComponents().matching((component) -> component.getName().equals("java")) + .all((javaComponent) -> mavenPublication.from(javaComponent)); + } + }); + }); project.getPlugins().withType(JavaPlatformPlugin.class) .all((javaPlugin) -> project.getComponents() .matching((component) -> component.getName().equals("javaPlatform")) diff --git a/spring-boot-project/spring-boot-docs/build.gradle b/spring-boot-project/spring-boot-docs/build.gradle index 0e69688b10..c52cfaa211 100644 --- a/spring-boot-project/spring-boot-docs/build.gradle +++ b/spring-boot-project/spring-boot-docs/build.gradle @@ -1,5 +1,5 @@ plugins { - id "java-base" + id "java" id "org.asciidoctor.jvm.convert" id "org.asciidoctor.jvm.pdf" id "org.springframework.boot.conventions" @@ -29,8 +29,12 @@ repositories { } } -sourceSets { - main +jar { + enabled = false +} + +javadoc { + enabled = false } plugins.withType(EclipsePlugin) { @@ -87,6 +91,15 @@ dependencies { mavenPluginDocumentation(project(path: ":spring-boot-project:spring-boot-tools:spring-boot-maven-plugin", configuration: "documentation")) + testImplementation(project(":spring-boot-project:spring-boot-actuator-autoconfigure")) + testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support")) + testImplementation("org.assertj:assertj-core") + testImplementation("org.junit.jupiter:junit-jupiter") + + testRuntimeOnly(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-web")) + testRuntimeOnly("com.h2database:h2") + testRuntimeOnly("org.springframework:spring-jdbc") + testSlices(project(path: ":spring-boot-project:spring-boot-test-autoconfigure", configuration: "testSliceMetadata")) } @@ -94,7 +107,7 @@ task dependencyVersions(type: org.springframework.boot.build.constraints.Extract enforcedPlatform(":spring-boot-project:spring-boot-dependencies") } -task javadoc(type: Javadoc) { +task aggregatedJavadoc(type: Javadoc) { dependsOn dependencyVersions project.rootProject.gradle.projectsEvaluated { Set excludedProjects = ['spring-boot-antlib', 'spring-boot-configuration-metadata', 'spring-boot-configuration-processor', @@ -288,7 +301,7 @@ task zip(type: Zip) { from(asciidoctorMultipage.outputDir) { into "reference/html" } - from(javadoc) { + from(aggregatedJavadoc) { into "api" } into("gradle-plugin") {