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 1cd04b7bd2..c5f920129e 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 @@ -75,7 +75,8 @@ public class MavenPluginPlugin implements Plugin { MavenExec generatePluginDescriptor = configurePluginDescriptorGenerationTasks(project, generateHelpMojo); DocumentPluginGoals documentPluginGoals = project.getTasks().create("documentPluginGoals", DocumentPluginGoals.class); - documentPluginGoals.setPluginXml(generatePluginDescriptor.getOutputs().getFiles().getSingleFile()); + File pluginXml = new File(generatePluginDescriptor.getOutputs().getFiles().getSingleFile(), "plugin.xml"); + documentPluginGoals.setPluginXml(pluginXml); documentPluginGoals.setOutputDir(new File(project.getBuildDir(), "docs/generated/goals/")); documentPluginGoals.dependsOn(generatePluginDescriptor); Jar jar = (Jar) project.getTasks().getByName(JavaPlugin.JAR_TASK_NAME); @@ -130,7 +131,7 @@ public class MavenPluginPlugin implements Plugin { FormatHelpMojoSource.class); copyFormattedHelpMojoSource.setGenerator(generateHelpMojo); copyFormattedHelpMojoSource.setOutputDir(generatedHelpMojoDir); - mainSourceSet.getAllJava().srcDir(generatedHelpMojoDir); + mainSourceSet.java((javaSources) -> javaSources.srcDir(generatedHelpMojoDir)); project.getTasks().getByName(mainSourceSet.getCompileJavaTaskName()).dependsOn(copyFormattedHelpMojoSource); Copy pluginDescriptorInputs = createCopyPluginDescriptorInputs(project, pluginDescriptorDir, mainSourceSet); pluginDescriptorInputs.dependsOn(mainSourceSet.getClassesTaskName()); @@ -152,7 +153,7 @@ public class MavenPluginPlugin implements Plugin { private MavenExec createGeneratePluginDescriptor(Project project, File mavenDir) { MavenExec generatePluginDescriptor = project.getTasks().create("generatePluginDescriptor", MavenExec.class); generatePluginDescriptor.args("org.apache.maven.plugins:maven-plugin-plugin:3.6.0:descriptor"); - generatePluginDescriptor.getOutputs().file(new File(mavenDir, "target/classes/META-INF/maven/plugin.xml")); + generatePluginDescriptor.getOutputs().dir(new File(mavenDir, "target/classes/META-INF/maven")); generatePluginDescriptor.getInputs().dir(new File(mavenDir, "target/classes/org")); generatePluginDescriptor.setProjectDir(mavenDir); return generatePluginDescriptor; @@ -164,7 +165,7 @@ public class MavenPluginPlugin implements Plugin { } private void includeHelpMojoInJar(Jar jar, JavaExec generateHelpMojo) { - jar.from(generateHelpMojo); + jar.from(generateHelpMojo).exclude("**/*.java"); jar.dependsOn(generateHelpMojo); }