From 3824512357448f6c683dccee2cbe79e9770c6ebd Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 23 Sep 2021 11:35:48 +0100 Subject: [PATCH] Tighten up build's task interdependencies Closes gh-28103 --- .../build/mavenplugin/MavenPluginPlugin.java | 17 +++++++++-------- .../spring-boot-docs/build.gradle | 8 ++++++++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/buildSrc/src/main/java/org/springframework/boot/build/mavenplugin/MavenPluginPlugin.java b/buildSrc/src/main/java/org/springframework/boot/build/mavenplugin/MavenPluginPlugin.java index 62420ed6932..d15a2bd9fdb 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/mavenplugin/MavenPluginPlugin.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/mavenplugin/MavenPluginPlugin.java @@ -110,18 +110,19 @@ public class MavenPluginPlugin implements Plugin { project.getDependencies() .components((components) -> components.all(MavenRepositoryComponentMetadataRule.class)); Copy task = project.getTasks().create("populateIntTestMavenRepository", Copy.class); - task.setDestinationDir(project.getBuildDir()); - task.into("int-test-maven-repository", - (copy) -> copyIntTestMavenRepositoryFiles(project, copy, runtimeClasspathMavenRepository)); + task.setDestinationDir(new File(project.getBuildDir(), "int-test-maven-repository")); + task.with(copyIntTestMavenRepositoryFiles(project, runtimeClasspathMavenRepository)); task.dependsOn(project.getTasks().getByName(MavenRepositoryPlugin.PUBLISH_TO_PROJECT_REPOSITORY_TASK_NAME)); project.getTasks().getByName(IntegrationTestPlugin.INT_TEST_TASK_NAME).dependsOn(task); } - private void copyIntTestMavenRepositoryFiles(Project project, CopySpec copy, + private CopySpec copyIntTestMavenRepositoryFiles(Project project, RuntimeClasspathMavenRepository runtimeClasspathMavenRepository) { - copy.from(project.getConfigurations().getByName(MavenRepositoryPlugin.MAVEN_REPOSITORY_CONFIGURATION_NAME)); - copy.from(new File(project.getBuildDir(), "maven-repository")); - copy.from(runtimeClasspathMavenRepository); + CopySpec copySpec = project.copySpec(); + copySpec.from(project.getConfigurations().getByName(MavenRepositoryPlugin.MAVEN_REPOSITORY_CONFIGURATION_NAME)); + copySpec.from(new File(project.getBuildDir(), "maven-repository")); + copySpec.from(runtimeClasspathMavenRepository); + return copySpec; } private void addDocumentPluginGoalsTask(Project project, MavenExec generatePluginDescriptorTask) { @@ -169,7 +170,7 @@ public class MavenPluginPlugin implements Plugin { FormatHelpMojoSourceTask copyFormattedHelpMojoSourceTask = createCopyFormattedHelpMojoSourceTask(project, generateHelpMojoTask, generatedHelpMojoDir); project.getTasks().getByName(mainSourceSet.getCompileJavaTaskName()).dependsOn(copyFormattedHelpMojoSourceTask); - mainSourceSet.java((javaSources) -> javaSources.srcDir(generatedHelpMojoDir)); + mainSourceSet.java((javaSources) -> javaSources.srcDir(copyFormattedHelpMojoSourceTask)); Copy pluginDescriptorInputs = createCopyPluginDescriptorInputs(project, pluginDescriptorDir, mainSourceSet); pluginDescriptorInputs.dependsOn(mainSourceSet.getClassesTaskName()); MavenExec task = createGeneratePluginDescriptorTask(project, pluginDescriptorDir); diff --git a/spring-boot-project/spring-boot-docs/build.gradle b/spring-boot-project/spring-boot-docs/build.gradle index e26f515e4d6..cabd98225e1 100644 --- a/spring-boot-project/spring-boot-docs/build.gradle +++ b/spring-boot-project/spring-boot-docs/build.gradle @@ -25,6 +25,14 @@ javadoc { enabled = false } +javadocJar { + enabled = false +} + +sourcesJar { + enabled = false +} + plugins.withType(EclipsePlugin) { extensions.getByType(org.gradle.plugins.ide.eclipse.model.EclipseModel).classpath { classpath -> classpath.plusConfigurations.add(configurations.getByName(sourceSets.main.runtimeClasspathConfigurationName))