Skip to content

Commit

Permalink
[MPLUGIN-470] *-mojo.xml (in PluginXdocGenerator) is overwritten when…
Browse files Browse the repository at this point in the history
… multiple locales are defined
  • Loading branch information
michael-o committed May 12, 2023
1 parent bf04d07 commit ca911b2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion maven-plugin-report-plugin/src/it/plugin-report/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
8 changes: 8 additions & 0 deletions maven-plugin-report-plugin/src/it/plugin-report/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
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;
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -222,7 +223,12 @@ public String getOutputName() {
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(
Expand Down

0 comments on commit ca911b2

Please sign in to comment.