This is an automated email from the ASF dual-hosted git repository. michaelo pushed a commit to branch doxia-sitetools-2.0.0-M4 in repository https://gitbox.apache.org/repos/asf/maven-site-plugin.git
commit 74ac389181bec07c2d2e1f2e394e7c8982c56b8e Author: Michael Osipov <[email protected]> AuthorDate: Mon Nov 14 22:55:47 2022 +0100 Upgrade Doxia (Sitetools) to 2.0.0-M4 --- pom.xml | 13 +++----- src/it/projects/MSITE-265/pom.xml | 2 +- src/it/projects/MSITE-456/verify.bsh | 8 ++--- src/it/projects/MSITE-658/pom.xml | 2 +- src/it/projects/full-reporting/pom.xml | 12 ++++--- .../org/apache/maven/plugins/site/its/App.java | 11 +++++-- .../org/apache/maven/plugins/site/its/App2.java | 9 ++++- src/it/projects/site-attach-descriptor/pom.xml | 2 +- src/it/projects/site-inheritance/verify.bsh | 24 +++++++------- src/it/projects/site-sd-lang/pom.xml | 2 +- .../site-sd-lang/src/site/de_AT/xdoc/index.xml | 36 ++++++++++++++++++++ .../site-sd-lang/src/site/de_DE/xdoc/index.xml | 36 ++++++++++++++++++++ .../projects/site-sd-lang/src/site/site_de_AT.xml | 38 ++++++++++++++++++++++ .../projects/site-sd-lang/src/site/site_de_DE.xml | 38 ++++++++++++++++++++++ .../maven/plugins/site/AbstractSiteMojo.java | 2 +- .../plugins/site/deploy/AbstractDeployMojo.java | 10 +++--- .../descriptor/AbstractSiteDescriptorMojo.java | 2 +- .../site/render/AbstractSiteRenderingMojo.java | 9 ++--- .../apache/maven/plugins/site/render/SiteMojo.java | 22 ++++--------- .../apache/maven/plugins/site/run/DoxiaFilter.java | 14 ++++---- .../apache/maven/plugins/site/run/SiteRunMojo.java | 7 ++-- src/site/apt/examples/creating-content.apt.vm | 9 +++-- 22 files changed, 230 insertions(+), 78 deletions(-) diff --git a/pom.xml b/pom.xml index b561fa9f..174d0820 100644 --- a/pom.xml +++ b/pom.xml @@ -198,18 +198,18 @@ under the License. <mavenVersion>3.2.5</mavenVersion> <javaVersion>8</javaVersion> <!-- for dependencies --> - <doxiaVersion>2.0.0-M3</doxiaVersion> - <doxiaSitetoolsVersion>2.0.0-M3</doxiaSitetoolsVersion> + <doxiaVersion>2.0.0-M4</doxiaVersion> + <doxiaSitetoolsVersion>2.0.0-M4-SNAPSHOT</doxiaSitetoolsVersion> <jettyVersion>9.4.48.v20220622</jettyVersion> <wagonVersion>3.5.2</wagonVersion> <slf4jVersion>1.7.36</slf4jVersion> <!-- for ITs --> - <checkstylePluginVersion>3.1.2</checkstylePluginVersion> + <checkstylePluginVersion>3.2.0</checkstylePluginVersion> <javadocPluginVersion>3.3.2</javadocPluginVersion> <pmdPluginVersion>3.16.0</pmdPluginVersion> <jxrPluginVersion>3.2.0</jxrPluginVersion> <projectInfoReportsPluginVersion>3.4.0</projectInfoReportsPluginVersion> - <surefirePluginVersion>2.22.2</surefirePluginVersion> + <surefirePluginVersion>3.0.0-M7</surefirePluginVersion> <mavenPluginPluginVersion>3.6.4</mavenPluginPluginVersion> <mavenReportingImplVersion>4.0.0-M2</mavenReportingImplVersion> <fluidoSkinVersion>1.11.1</fluidoSkinVersion> @@ -341,11 +341,6 @@ under the License. <artifactId>doxia-core</artifactId> <version>${doxiaVersion}</version> </dependency> - <dependency> - <groupId>org.apache.maven.doxia</groupId> - <artifactId>doxia-module-xhtml</artifactId> - <version>${doxiaVersion}</version> - </dependency> <dependency> <groupId>org.apache.maven.doxia</groupId> <artifactId>doxia-module-xhtml5</artifactId> diff --git a/src/it/projects/MSITE-265/pom.xml b/src/it/projects/MSITE-265/pom.xml index 91f7063c..5f6104be 100644 --- a/src/it/projects/MSITE-265/pom.xml +++ b/src/it/projects/MSITE-265/pom.xml @@ -43,7 +43,7 @@ under the License. <artifactId>maven-site-plugin</artifactId> <version>@project.version@</version> <configuration> - <locales>en,ca,cs,da,de,es,fr,hu,it,ja,ko,nl,no,pl,pt,pt_BR,sk,sv,tr,zh_CN</locales> + <locales>default,en,ca,cs,da,de,es,fr,hu,it,ja,ko,nl,no,pl,pt,pt_BR,sk,sv,tr,zh_CN</locales> </configuration> </plugin> </plugins> diff --git a/src/it/projects/MSITE-456/verify.bsh b/src/it/projects/MSITE-456/verify.bsh index f54f9bc6..cf91a95b 100644 --- a/src/it/projects/MSITE-456/verify.bsh +++ b/src/it/projects/MSITE-456/verify.bsh @@ -40,8 +40,8 @@ try } String content = FileUtils.fileRead( parentIndex, "UTF-8" ); - int index1 = content.indexOf( "<a href=\"child/index.html\" title=\"MSITE-456 - child\">MSITE-456 - child</a>" ); - int index2 = content.indexOf( "<a href=\"project-info.html\" title=\"Project Information\">Project Information</a>" ); + int index1 = content.indexOf( "<a href=\"child/index.html\" title=\"MSITE-456 - child\"><span class=\"none\"></span>MSITE-456 - child</a>" ); + int index2 = content.indexOf( "<a href=\"project-info.html\" title=\"Project Information\"><span class=\"icon-chevron-down\"></span>Project Information</a>" ); if ( index1 < 0 || index2 < 0 ) @@ -75,8 +75,8 @@ try } content = FileUtils.fileRead( childIndex, "UTF-8" ); - index1 = content.indexOf( "<a href=\"../index.html\" title=\"MSITE-456 - parent\">MSITE-456 - parent</a>" ); - index2 = content.indexOf( "<a href=\"project-info.html\" title=\"Project Information\">Project Information</a>" ); + index1 = content.indexOf( "<a href=\"../index.html\" title=\"MSITE-456 - parent\"><span class=\"none\"></span>MSITE-456 - parent</a>" ); + index2 = content.indexOf( "<a href=\"project-info.html\" title=\"Project Information\"><span class=\"icon-chevron-down\"></span>Project Information</a>" ); if ( index1 < 0 || index2 < 0 ) { diff --git a/src/it/projects/MSITE-658/pom.xml b/src/it/projects/MSITE-658/pom.xml index c90545b7..d329dd49 100644 --- a/src/it/projects/MSITE-658/pom.xml +++ b/src/it/projects/MSITE-658/pom.xml @@ -53,7 +53,7 @@ under the License. <artifactId>maven-site-plugin</artifactId> <version>@project.version@</version> <configuration> - <locales>en,de</locales> + <locales>default,en,de</locales> </configuration> </plugin> </plugins> diff --git a/src/it/projects/full-reporting/pom.xml b/src/it/projects/full-reporting/pom.xml index 25e958e8..2637cd94 100644 --- a/src/it/projects/full-reporting/pom.xml +++ b/src/it/projects/full-reporting/pom.xml @@ -25,7 +25,7 @@ under the License. <parent> <groupId>org.apache.maven</groupId> <artifactId>maven-parent</artifactId> - <version>34</version> + <version>37</version> </parent> <groupId>org.apache.maven.plugins.site.its</groupId> @@ -69,9 +69,13 @@ under the License. <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>@checkstylePluginVersion@</version> - <configuration> - <configLocation>sun_checks.xml</configLocation> - </configuration> + <dependencies> + <dependency> + <groupId>org.apache.maven.shared</groupId> + <artifactId>maven-shared-resources</artifactId> + <version>4</version> + </dependency> + </dependencies> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> diff --git a/src/it/projects/full-reporting/src/main/java/org/apache/maven/plugins/site/its/App.java b/src/it/projects/full-reporting/src/main/java/org/apache/maven/plugins/site/its/App.java index e9543294..6c9d0d81 100644 --- a/src/it/projects/full-reporting/src/main/java/org/apache/maven/plugins/site/its/App.java +++ b/src/it/projects/full-reporting/src/main/java/org/apache/maven/plugins/site/its/App.java @@ -23,14 +23,21 @@ package org.apache.maven.plugins.site.its; * Hello world! * */ -public class App +public class App { + /** + * main + */ public static void main( String[] args ) { System.out.println( "Hello World!" ); } - public void foo(){ + /** + * foo + */ + public void foo() + { System.out.println( "foo" ); } } diff --git a/src/it/projects/full-reporting/src/main/java/org/apache/maven/plugins/site/its/App2.java b/src/it/projects/full-reporting/src/main/java/org/apache/maven/plugins/site/its/App2.java index 7fd9f925..127eebf0 100644 --- a/src/it/projects/full-reporting/src/main/java/org/apache/maven/plugins/site/its/App2.java +++ b/src/it/projects/full-reporting/src/main/java/org/apache/maven/plugins/site/its/App2.java @@ -25,12 +25,19 @@ package org.apache.maven.plugins.site.its; */ public class App2 { + /** + * main + */ public static void main( String[] args ) { System.out.println( "Hello World!" ); } - public void foo(){ + /** + * foo + */ + public void foo() + { System.out.println( "foo" ); } } diff --git a/src/it/projects/site-attach-descriptor/pom.xml b/src/it/projects/site-attach-descriptor/pom.xml index 845879a0..2a43411f 100644 --- a/src/it/projects/site-attach-descriptor/pom.xml +++ b/src/it/projects/site-attach-descriptor/pom.xml @@ -69,7 +69,7 @@ under the License. <artifactId>maven-site-plugin</artifactId> <version>@project.version@</version> <configuration> - <locales>en,sv</locales> + <locales>default,en,sv</locales> </configuration> <executions> <execution> diff --git a/src/it/projects/site-inheritance/verify.bsh b/src/it/projects/site-inheritance/verify.bsh index 4483b87e..68ac2f44 100644 --- a/src/it/projects/site-inheritance/verify.bsh +++ b/src/it/projects/site-inheritance/verify.bsh @@ -59,7 +59,7 @@ try } String content = FileUtils.fileRead( index, "UTF-8" ); - int indexOf = content.indexOf( "<a href=\"../index.html\" title=\"Aggregator\">Aggregator</a>" ); + int indexOf = content.indexOf( "<a href=\"../index.html\" title=\"Aggregator\"><span class=\"none\"></span>Aggregator</a>" ); if ( indexOf < 0 ) { System.err.println( "deployed junk index.html is missing module link!" ); @@ -75,9 +75,9 @@ try } content = FileUtils.fileRead( index, "UTF-8" ); - int index1 = content.indexOf( "<a href=\"www/website/deep/down/below/index.html\" title=\"Child and Module\">Child and Module</a></li>" ); - int index2 = content.indexOf( "<a href=\"inheriting_child/index.html\" title=\"Inheriting Child\">Inheriting Child</a>" ); - int index3 = content.indexOf( "<a href=\"www/website/module/index.html\" title=\"Module\">Module</a>" ); + int index1 = content.indexOf( "<a href=\"www/website/deep/down/below/index.html\" title=\"Child and Module\"><span class=\"none\"></span>Child and Module</a></li>" ); + int index2 = content.indexOf( "<a href=\"inheriting_child/index.html\" title=\"Inheriting Child\"><span class=\"none\"></span>Inheriting Child</a>" ); + int index3 = content.indexOf( "<a href=\"www/website/module/index.html\" title=\"Module\"><span class=\"none\"></span>Module</a>" ); int index4 = content.indexOf( "<a href=\"./\" title=\"Aggregator\">Aggregator</a>" ); if ( index1 < 0 || index2 < 0 || index3 < 0 || index4 < 0 ) { @@ -237,7 +237,7 @@ try } content = FileUtils.fileRead( index, "UTF-8" ); - int indexOf = content.indexOf( "<a href=\"../index.html\" title=\"Aggregator\">Aggregator</a>" ); + int indexOf = content.indexOf( "<a href=\"../index.html\" title=\"Aggregator\"><span class=\"none\"></span>Aggregator</a>" ); if ( indexOf < 0 ) { System.err.println( "staged junk index.html is missing module link!" ); @@ -253,9 +253,9 @@ try } content = FileUtils.fileRead( index, "UTF-8" ); - int index1 = content.indexOf( "<a href=\"www/website/deep/down/below/index.html\" title=\"Child and Module\">Child and Module</a>" ); - int index2 = content.indexOf( "<a href=\"inheriting_child/index.html\" title=\"Inheriting Child\">Inheriting Child</a>" ); - int index3 = content.indexOf( "<a href=\"www/website/module/index.html\" title=\"Module\">Module</a>" ); + int index1 = content.indexOf( "<a href=\"www/website/deep/down/below/index.html\" title=\"Child and Module\"><span class=\"none\"></span>Child and Module</a>" ); + int index2 = content.indexOf( "<a href=\"inheriting_child/index.html\" title=\"Inheriting Child\"><span class=\"none\"></span>Inheriting Child</a>" ); + int index3 = content.indexOf( "<a href=\"www/website/module/index.html\" title=\"Module\"><span class=\"none\"></span>Module</a>" ); int index4 = content.indexOf( "<a href=\"./\" title=\"Aggregator\">Aggregator</a>" ); if ( index1 < 0 || index2 < 0 || index3 < 0 || index4 < 0 ) { @@ -414,7 +414,7 @@ try } content = FileUtils.fileRead( index, "UTF-8" ); - int indexOf = content.indexOf( "<a href=\"../index.html\" title=\"Aggregator\">Aggregator</a>" ); + int indexOf = content.indexOf( "<a href=\"../index.html\" title=\"Aggregator\"><span class=\"none\"></span>Aggregator</a>" ); if ( indexOf < 0 ) { System.err.println( "stage-deployed junk index.html is missing module link!" ); @@ -430,9 +430,9 @@ try } content = FileUtils.fileRead( index, "UTF-8" ); - int index1 = content.indexOf( "<a href=\"www/website/deep/down/below/index.html\" title=\"Child and Module\">Child and Module</a>" ); - int index2 = content.indexOf( "<a href=\"inheriting_child/index.html\" title=\"Inheriting Child\">Inheriting Child</a>" ); - int index3 = content.indexOf( "<a href=\"www/website/module/index.html\" title=\"Module\">Module</a>" ); + int index1 = content.indexOf( "<a href=\"www/website/deep/down/below/index.html\" title=\"Child and Module\"><span class=\"none\"></span>Child and Module</a>" ); + int index2 = content.indexOf( "<a href=\"inheriting_child/index.html\" title=\"Inheriting Child\"><span class=\"none\"></span>Inheriting Child</a>" ); + int index3 = content.indexOf( "<a href=\"www/website/module/index.html\" title=\"Module\"><span class=\"none\"></span>Module</a>" ); int index4 = content.indexOf( "<a href=\"./\" title=\"Aggregator\">Aggregator</a>" ); if ( index1 < 0 || index2 < 0 || index3 < 0 || index4 < 0 ) { diff --git a/src/it/projects/site-sd-lang/pom.xml b/src/it/projects/site-sd-lang/pom.xml index 087c3f68..124a8e61 100755 --- a/src/it/projects/site-sd-lang/pom.xml +++ b/src/it/projects/site-sd-lang/pom.xml @@ -50,7 +50,7 @@ under the License. <artifactId>maven-site-plugin</artifactId> <version>@project.version@</version> <configuration> - <locales>en,fr</locales> + <locales>default,en,fr,de,de_DE,de_AT,zh_TW,ru_UA</locales> </configuration> </plugin> </plugins> diff --git a/src/it/projects/site-sd-lang/src/site/de_AT/xdoc/index.xml b/src/it/projects/site-sd-lang/src/site/de_AT/xdoc/index.xml new file mode 100644 index 00000000..7781013e --- /dev/null +++ b/src/it/projects/site-sd-lang/src/site/de_AT/xdoc/index.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="ISO-8859-15"?> + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<document> + <properties> + <author>Hans M�ller</author> + <title>Servus zum Index</title> + </properties> + <body> + + <section name="presentation"> + <p> + Diese Seite ist f�r de_AT + </p> + </section> + + </body> +</document> diff --git a/src/it/projects/site-sd-lang/src/site/de_DE/xdoc/index.xml b/src/it/projects/site-sd-lang/src/site/de_DE/xdoc/index.xml new file mode 100644 index 00000000..d0b711b3 --- /dev/null +++ b/src/it/projects/site-sd-lang/src/site/de_DE/xdoc/index.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="ISO-8859-15"?> + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<document> + <properties> + <author>Hans M�ller</author> + <title>Guten Tag zum Index</title> + </properties> + <body> + + <section name="presentation"> + <p> + Diese Seite ist f�r de_DE + </p> + </section> + + </body> +</document> diff --git a/src/it/projects/site-sd-lang/src/site/site_de_AT.xml b/src/it/projects/site-sd-lang/src/site/site_de_AT.xml new file mode 100644 index 00000000..de5bba83 --- /dev/null +++ b/src/it/projects/site-sd-lang/src/site/site_de_AT.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="ISO-8859-15"?> + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<project name="${project.name}"> + <skin> + <groupId>org.apache.maven.skins</groupId> + <artifactId>maven-fluido-skin</artifactId> + <version>${fluidoSkinVersion}</version> + </skin> + + <version position="left" /> + + <body> + <menu name="${project.name}"> + <item name="Einstieg" href="index.html" /> + <item name="J�nner" href="jan.html" /> + </menu> + <menu ref="reports"/> + </body> +</project> diff --git a/src/it/projects/site-sd-lang/src/site/site_de_DE.xml b/src/it/projects/site-sd-lang/src/site/site_de_DE.xml new file mode 100644 index 00000000..537d975d --- /dev/null +++ b/src/it/projects/site-sd-lang/src/site/site_de_DE.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="ISO-8859-15"?> + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<project name="${project.name}"> + <skin> + <groupId>org.apache.maven.skins</groupId> + <artifactId>maven-fluido-skin</artifactId> + <version>${fluidoSkinVersion}</version> + </skin> + + <version position="left" /> + + <body> + <menu name="${project.name}"> + <item name="Einstieg" href="index.html" /> + <item name="Januar" href="jan.html" /> + </menu> + <menu ref="reports"/> + </body> +</project> diff --git a/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java b/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java index 15a18ed9..72f91dba 100644 --- a/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java +++ b/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java @@ -45,7 +45,7 @@ public abstract class AbstractSiteMojo * * @since 2.3 */ - @Parameter( property = "locales", defaultValue = "en" ) + @Parameter( property = "locales", defaultValue = "default" ) private String locales; /** diff --git a/src/main/java/org/apache/maven/plugins/site/deploy/AbstractDeployMojo.java b/src/main/java/org/apache/maven/plugins/site/deploy/AbstractDeployMojo.java index 23555347..d1067076 100644 --- a/src/main/java/org/apache/maven/plugins/site/deploy/AbstractDeployMojo.java +++ b/src/main/java/org/apache/maven/plugins/site/deploy/AbstractDeployMojo.java @@ -426,11 +426,11 @@ public abstract class AbstractDeployMojo getLog().info( "Pushing " + inputDirectory ); // Default is first in the list - final String defaultLocale = localesList.get( 0 ).getLanguage(); + final Locale defaultLocale = localesList.get( 0 ); for ( Locale locale : localesList ) { - if ( locale.getLanguage().equals( defaultLocale ) ) + if ( locale.equals( defaultLocale ) ) { // TODO: this also uploads the non-default locales, // is there a way to exclude directories in wagon? @@ -440,11 +440,11 @@ public abstract class AbstractDeployMojo } else { - getLog().info( " >>> to " + appendSlash( repository.getUrl() ) + locale.getLanguage() + "/" + getLog().info( " >>> to " + appendSlash( repository.getUrl() ) + locale + "/" + relativeDir ); - wagon.putDirectory( new File( inputDirectory, locale.getLanguage() ), - locale.getLanguage() + "/" + relativeDir ); + wagon.putDirectory( new File( inputDirectory, locale.toString() ), + locale + "/" + relativeDir ); } } } diff --git a/src/main/java/org/apache/maven/plugins/site/descriptor/AbstractSiteDescriptorMojo.java b/src/main/java/org/apache/maven/plugins/site/descriptor/AbstractSiteDescriptorMojo.java index 829f6b37..9635dac6 100644 --- a/src/main/java/org/apache/maven/plugins/site/descriptor/AbstractSiteDescriptorMojo.java +++ b/src/main/java/org/apache/maven/plugins/site/descriptor/AbstractSiteDescriptorMojo.java @@ -107,7 +107,7 @@ public abstract class AbstractSiteDescriptorMojo Locale defaultLocale = localesList.get( 0 ); // MSITE-658 - final String localeUrl = locale.equals( defaultLocale ) ? url : append( url, locale.getLanguage() ); + final String localeUrl = locale.equals( defaultLocale ) ? url : append( url, locale.toString() ); getLog().info( "Relativizing decoration links with respect to localized project URL: " + localeUrl ); assembler.resolvePaths( decorationModel, localeUrl ); diff --git a/src/main/java/org/apache/maven/plugins/site/render/AbstractSiteRenderingMojo.java b/src/main/java/org/apache/maven/plugins/site/render/AbstractSiteRenderingMojo.java index 589470f0..1f93053c 100644 --- a/src/main/java/org/apache/maven/plugins/site/render/AbstractSiteRenderingMojo.java +++ b/src/main/java/org/apache/maven/plugins/site/render/AbstractSiteRenderingMojo.java @@ -28,6 +28,7 @@ import org.apache.maven.doxia.siterenderer.Renderer; import org.apache.maven.doxia.siterenderer.RendererException; import org.apache.maven.doxia.siterenderer.RenderingContext; import org.apache.maven.doxia.siterenderer.SiteRenderingContext; +import org.apache.maven.doxia.tools.SiteTool; import org.apache.maven.doxia.tools.SiteToolException; import org.apache.maven.execution.MavenSession; import org.apache.maven.model.ReportPlugin; @@ -314,11 +315,11 @@ public abstract class AbstractSiteRenderingMojo extends AbstractSiteDescriptorMo // Generate static site context.setRootDirectory( project.getBasedir() ); - if ( !locale.getLanguage().equals( Locale.getDefault().getLanguage() ) ) + if ( !locale.equals( SiteTool.DEFAULT_LOCALE ) ) { - context.addSiteDirectory( new File( siteDirectory, locale.getLanguage() ) ); - context.addModuleDirectory( new File( xdocDirectory, locale.getLanguage() ), "xdoc" ); - context.addModuleDirectory( new File( xdocDirectory, locale.getLanguage() ), "fml" ); + context.addSiteDirectory( new File( siteDirectory, locale.toString() ) ); + context.addModuleDirectory( new File( xdocDirectory, locale.toString() ), "xdoc" ); + context.addModuleDirectory( new File( xdocDirectory, locale.toString() ), "fml" ); } else { diff --git a/src/main/java/org/apache/maven/plugins/site/render/SiteMojo.java b/src/main/java/org/apache/maven/plugins/site/render/SiteMojo.java index f4066d8b..9b8412f7 100644 --- a/src/main/java/org/apache/maven/plugins/site/render/SiteMojo.java +++ b/src/main/java/org/apache/maven/plugins/site/render/SiteMojo.java @@ -32,6 +32,7 @@ import org.apache.maven.doxia.siterenderer.DocumentRenderer; import org.apache.maven.doxia.siterenderer.DoxiaDocumentRenderer; import org.apache.maven.doxia.siterenderer.RendererException; import org.apache.maven.doxia.siterenderer.SiteRenderingContext; +import org.apache.maven.doxia.tools.SiteTool; import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; @@ -125,21 +126,12 @@ public class SiteMojo // Default is first in the list Locale defaultLocale = localesList.get( 0 ); - Locale.setDefault( defaultLocale ); for ( Locale locale : localesList ) { - if ( locale == defaultLocale ) - { - getLog().info( buffer().strong( "Rendering site with default locale " + locale.getDisplayName() - + " (" + locale + ")" ).toString() ); - } - else - { - getLog().info( "" ); - getLog().info( buffer().strong( "Rendering localized site for " + locale.getDisplayName() + " (" - + locale + ")" ).toString() ); - } + getLog().info( "Rendering site for " + + buffer().strong( ( locale.equals( defaultLocale ) + ? "default locale" : "locale '" + locale + "'" ) ).toString() ); renderLocale( locale, reports ); } } @@ -216,7 +208,7 @@ public class SiteMojo /** * Render Doxia documents from the list given, but not reports. - * + * * @param documents a collection of documents containing both Doxia source files and reports * @return the sublist of documents that are not Doxia source files */ @@ -292,13 +284,13 @@ public class SiteMojo private File getOutputDirectory( Locale locale ) { File file; - if ( locale.getLanguage().equals( Locale.getDefault().getLanguage() ) ) + if ( locale.equals( SiteTool.DEFAULT_LOCALE ) ) { file = outputDirectory; } else { - file = new File( outputDirectory, locale.getLanguage() ); + file = new File( outputDirectory, locale.toString() ); } // Safety diff --git a/src/main/java/org/apache/maven/plugins/site/run/DoxiaFilter.java b/src/main/java/org/apache/maven/plugins/site/run/DoxiaFilter.java index 012ae187..7a11e2a8 100644 --- a/src/main/java/org/apache/maven/plugins/site/run/DoxiaFilter.java +++ b/src/main/java/org/apache/maven/plugins/site/run/DoxiaFilter.java @@ -105,17 +105,17 @@ public class DoxiaFilter Map<String, DocumentRenderer> documents; SiteRenderingContext generatedSiteContext; - String languageWanted = null; + String localeWanted = null; for ( Locale locale : localesList ) { - if ( path.startsWith( locale.getLanguage() + "/" ) ) + if ( path.startsWith( locale + "/" ) ) { - languageWanted = locale.getLanguage(); - path = path.substring( languageWanted.length() + 1 ); + localeWanted = locale.toString(); + path = path.substring( localeWanted.length() + 1 ); } } - if ( languageWanted == null ) + if ( localeWanted == null ) { DoxiaBean defaultDoxiaBean = i18nDoxiaContexts.get( "default" ); if ( defaultDoxiaBean == null ) @@ -128,10 +128,10 @@ public class DoxiaFilter } else { - DoxiaBean i18nDoxiaBean = i18nDoxiaContexts.get( languageWanted ); + DoxiaBean i18nDoxiaBean = i18nDoxiaContexts.get( localeWanted ); if ( i18nDoxiaBean == null ) { - throw new ServletException( "No doxia bean found for the language " + languageWanted ); + throw new ServletException( "No doxia bean found for locale '" + localeWanted + "'" ); } context = i18nDoxiaBean.getContext(); documents = i18nDoxiaBean.getDocuments(); diff --git a/src/main/java/org/apache/maven/plugins/site/run/SiteRunMojo.java b/src/main/java/org/apache/maven/plugins/site/run/SiteRunMojo.java index b4346986..811e791a 100644 --- a/src/main/java/org/apache/maven/plugins/site/run/SiteRunMojo.java +++ b/src/main/java/org/apache/maven/plugins/site/run/SiteRunMojo.java @@ -139,7 +139,6 @@ public class SiteRunMojo // Default is first in the list Locale defaultLocale = localesList.get( 0 ); - Locale.setDefault( defaultLocale ); try { @@ -166,11 +165,11 @@ public class SiteRunMojo else { i18nGeneratedSiteContext.addSiteDirectory( new File( generatedSiteDirectory, - locale.getLanguage() ) ); + locale.toString() ) ); doxiaBean = new DoxiaBean( i18nContext, i18nDocuments, i18nGeneratedSiteContext ); } - i18nDoxiaContexts.put( locale.getLanguage(), doxiaBean ); + i18nDoxiaContexts.put( locale.toString(), doxiaBean ); if ( defaultLocale.equals( locale ) ) { i18nDoxiaContexts.put( "default", doxiaBean ); @@ -182,7 +181,7 @@ public class SiteRunMojo } else { - siteRenderer.copyResources( i18nContext, new File( tempWebappDirectory, locale.getLanguage() ) ); + siteRenderer.copyResources( i18nContext, new File( tempWebappDirectory, locale.toString() ) ); } } diff --git a/src/site/apt/examples/creating-content.apt.vm b/src/site/apt/examples/creating-content.apt.vm index 52b93088..4770396b 100644 --- a/src/site/apt/examples/creating-content.apt.vm +++ b/src/site/apt/examples/creating-content.apt.vm @@ -213,7 +213,7 @@ Creating Content <artifactId>maven-site-plugin</artifactId> <version>${project.version}</version> <configuration> - <locales>en,fr</locales> + <locales>default,fr</locales> </configuration> </plugin> </plugins> @@ -222,10 +222,9 @@ Creating Content </project> +------------------ - This will generate both an English and a French version of the site. If - <<<en>>> is your current locale, then it will be generated at the root of the - site, with a copy of the French translation of the site in the <<<fr/>>> - subdirectory. + This will generate both a default (<<<Locale#ROOT>>>) and a French version of the site. + It will be generated at the root of the site, with a copy of the French + translation of the site in the <<<fr/>>> subdirectory. To add your own content for that translation instead of using the default, create a subdirectory with that locale's name in your site directory and
