Author: ltheussl Date: Sun Oct 14 08:03:21 2012 New Revision: 1398031 URL: http://svn.apache.org/viewvc?rev=1398031&view=rev Log: [MSITE-658] 'relativizeDecorationLinks' not working using multiple 'locales'. Submitted by: Christian Schulte
Added: maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/ maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/invoker.properties maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/pom.xml maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/src/ maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/src/site/ maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/src/site/site.xml maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/src/site/site_de.xml maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/verify.bsh Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java Added: maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/invoker.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/invoker.properties?rev=1398031&view=auto ============================================================================== --- maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/invoker.properties (added) +++ maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/invoker.properties Sun Oct 14 08:03:21 2012 @@ -0,0 +1 @@ +invoker.goals.1 = clean site:site Added: maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/pom.xml?rev=1398031&view=auto ============================================================================== --- maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/pom.xml (added) +++ maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/pom.xml Sun Oct 14 08:03:21 2012 @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>MSITE-658</groupId> + <artifactId>MSITE-658</artifactId> + <version>1.0-SNAPSHOT</version> + + <name>MSITE-658</name> + <url>http://maven.apache.org/sub-directory</url> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + </properties> + + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-site-plugin</artifactId> + <version>@project.version@</version> + <configuration> + <locales>en,de</locales> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + + <reporting> + <plugins> + <plugin> + <artifactId>maven-project-info-reports-plugin</artifactId> + <version>2.5.1</version> + <reportSets> + <reportSet> + <reports> + <report>index</report> + <report>license</report> + </reports> + </reportSet> + </reportSets> + </plugin> + </plugins> + </reporting> +</project> Added: maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/src/site/site.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/src/site/site.xml?rev=1398031&view=auto ============================================================================== --- maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/src/site/site.xml (added) +++ maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/src/site/site.xml Sun Oct 14 08:03:21 2012 @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/DECORATION/1.3.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/DECORATION/1.3.0 http://maven.apache.org/xsd/decoration-1.3.0.xsd"> + <body> + <menu name="Main" inherit="top"> + <item name="Home" href="http://maven.apache.org/sub-directory/index.html"/> + </menu> + </body> +</project> Added: maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/src/site/site_de.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/src/site/site_de.xml?rev=1398031&view=auto ============================================================================== --- maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/src/site/site_de.xml (added) +++ maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/src/site/site_de.xml Sun Oct 14 08:03:21 2012 @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/DECORATION/1.3.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/DECORATION/1.3.0 http://maven.apache.org/xsd/decoration-1.3.0.xsd"> + <body> + <menu name="Main" inherit="top"> + <item name="Heim" href="http://maven.apache.org/sub-directory/de/index.html"/> + </menu> + </body> +</project> Added: maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/verify.bsh URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/verify.bsh?rev=1398031&view=auto ============================================================================== --- maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/verify.bsh (added) +++ maven/plugins/trunk/maven-site-plugin/src/it/MSITE-658/verify.bsh Sun Oct 14 08:03:21 2012 @@ -0,0 +1,81 @@ + +/* + * 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. + */ + +import java.io.*; + +import org.codehaus.plexus.util.*; + +boolean result = true; + +try +{ + final File siteDirectory = new File( basedir, "target/site" ); + if ( !siteDirectory.isDirectory() ) + { + System.err.println( "site is missing or not a directory." ); + result = false; + } + + File license = new File( siteDirectory, "license.html" ); + if ( !license.exists() || license.isDirectory() ) + { + System.err.println( "no license file or is a directory." ); + result = false; + } + + String content = FileUtils.fileRead( license, "UTF-8" ); + int index = content.indexOf( "<a href=\"index.html\" title=\"Home\">Home</a>" ); + if ( index < 0 ) + { + System.err.println( "license.html has incorrect links!" ); + result = false; + } + + // de + + final File deDirectory = new File( siteDirectory, "de" ); + if ( !deDirectory.isDirectory() ) + { + System.err.println( "site is missing or not a directory." ); + result = false; + } + + license = new File( deDirectory, "license.html" ); + if ( !license.exists() || license.isDirectory() ) + { + System.err.println( "no license file or is a directory." ); + result = false; + } + + content = FileUtils.fileRead( license, "UTF-8" ); + int index = content.indexOf( "<a href=\"index.html\" title=\"Heim\">Heim</a>" ); + if ( index < 0 ) + { + System.err.println( "license.html has incorrect links!" ); + result = false; + } +} +catch ( IOException e ) +{ + e.printStackTrace(); + result = false; +} + +return result; Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java?rev=1398031&r1=1398030&r2=1398031&view=diff ============================================================================== --- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java (original) +++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java Sun Oct 14 08:03:21 2012 @@ -298,8 +298,11 @@ public abstract class AbstractSiteRender } else { - getLog().info( "Relativizing decoration links with respect to project URL: " + url ); - assembler.resolvePaths( decorationModel, url ); + // MSITE-658 + final String localeUrl = + locale.equals( Locale.getDefault() ) ? url : url + "/" + locale.getLanguage(); + getLog().info( "Relativizing decoration links with respect to project URL: " + localeUrl ); + assembler.resolvePaths( decorationModel, localeUrl ); } }