This is an automated email from the ASF dual-hosted git repository. michaelo pushed a commit to branch fixes in repository https://gitbox.apache.org/repos/asf/maven-plugin-tools.git
commit 4b9556f99f5335cf0f4ebba3e151f8c0157ea7d8 Author: Michael Osipov <micha...@apache.org> AuthorDate: Tue May 9 23:12:43 2023 +0200 [MPLUGIN-470] *-mojo.xml (in PluginXdocGenerator) is overwritten when multiple locales are defined --- maven-plugin-report-plugin/src/it/plugin-report/pom.xml | 2 +- .../src/it/plugin-report/verify.groovy | 8 ++++++++ .../org/apache/maven/plugin/plugin/report/PluginReport.java | 12 +++++++++--- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/maven-plugin-report-plugin/src/it/plugin-report/pom.xml b/maven-plugin-report-plugin/src/it/plugin-report/pom.xml index 864bb3de..a6559802 100644 --- a/maven-plugin-report-plugin/src/it/plugin-report/pom.xml +++ b/maven-plugin-report-plugin/src/it/plugin-report/pom.xml @@ -91,7 +91,7 @@ under the License. <artifactId>maven-site-plugin</artifactId> <version>@sitePluginVersion@</version> <configuration> - <locales>en</locales> + <locales>en,de,fr</locales> </configuration> </plugin> </plugins> diff --git a/maven-plugin-report-plugin/src/it/plugin-report/verify.groovy b/maven-plugin-report-plugin/src/it/plugin-report/verify.groovy index f57200f2..2f24cb8a 100644 --- a/maven-plugin-report-plugin/src/it/plugin-report/verify.groovy +++ b/maven-plugin-report-plugin/src/it/plugin-report/verify.groovy @@ -28,3 +28,11 @@ assert !pluginInfo.text.contains('Disk Space') // check JDK and Maven requirements assert pluginInfo.text.contains('1.8') assert pluginInfo.text.contains('3.2.5') + +assert new File( basedir, 'target/site/de/noop-mojo.html' ).isFile() +assert new File( basedir, 'target/site/de/report-mojo.html' ).isFile() +assert new File( basedir, 'target/site/de/plugin-info.html' ).isFile() + +assert new File( basedir, 'target/site/fr/noop-mojo.html' ).isFile() +assert new File( basedir, 'target/site/fr/report-mojo.html' ).isFile() +assert new File( basedir, 'target/site/fr/plugin-info.html' ).isFile() diff --git a/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginReport.java b/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginReport.java index b9dd4e11..3816b4c5 100644 --- a/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginReport.java +++ b/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugin/plugin/report/PluginReport.java @@ -31,6 +31,7 @@ import java.util.Optional; import java.util.ResourceBundle; import org.apache.maven.doxia.sink.Sink; +import org.apache.maven.doxia.tools.SiteTool; import org.apache.maven.model.Plugin; import org.apache.maven.model.Prerequisites; import org.apache.maven.plugin.descriptor.MojoDescriptor; @@ -76,8 +77,8 @@ public class PluginReport extends AbstractMavenReport { * * @since 3.7.0 */ - @Parameter(defaultValue = "${project.build.directory}/generated-site/xdoc") - private File outputDirectory; + @Parameter(defaultValue = "${project.build.directory}/generated-site") + private File generatedSiteDirectory; /** * Set this to "true" to skip generating the report. @@ -222,7 +223,12 @@ public class PluginReport extends AbstractMavenReport { private void generateMojosDocumentation(PluginDescriptor pluginDescriptor, Locale locale) throws MavenReportException { try { - File outputDir = outputDirectory; + File outputDir; + if (!locale.equals(SiteTool.DEFAULT_LOCALE)) { + outputDir = new File(new File(generatedSiteDirectory, locale.toString()), "xdoc"); + } else { + outputDir = new File(generatedSiteDirectory, "xdoc"); + } outputDir.mkdirs(); PluginXdocGenerator generator = new PluginXdocGenerator(