You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by vs...@apache.org on 2006/11/11 19:47:57 UTC

svn commit: r473770 - in /maven/plugins/trunk/maven-site-plugin: ./ src/main/java/org/apache/maven/plugins/site/ src/site/apt/examples/ src/test/java/ src/test/java/org/ src/test/java/org/apache/ src/test/java/org/apache/maven/ src/test/java/org/apache...

Author: vsiveton
Date: Sat Nov 11 10:47:55 2006
New Revision: 473770

URL: http://svn.apache.org/viewvc?view=rev&rev=473770
Log:
MSITE-191: ${project.organization.name} is not evaluated in site.xml

o Modified getInterpolatedSiteDescriptorContent() to handle all ${project.*} and environment variables
o added unit test case with maven-plugin-testing-harness
o updated documentation

Added:
    maven/plugins/trunk/maven-site-plugin/src/test/java/
    maven/plugins/trunk/maven-site-plugin/src/test/java/org/
    maven/plugins/trunk/maven-site-plugin/src/test/java/org/apache/
    maven/plugins/trunk/maven-site-plugin/src/test/java/org/apache/maven/
    maven/plugins/trunk/maven-site-plugin/src/test/java/org/apache/maven/plugins/
    maven/plugins/trunk/maven-site-plugin/src/test/java/org/apache/maven/plugins/site/
    maven/plugins/trunk/maven-site-plugin/src/test/java/org/apache/maven/plugins/site/SiteMojoTest.java   (with props)
    maven/plugins/trunk/maven-site-plugin/src/test/java/org/apache/maven/plugins/site/stubs/
    maven/plugins/trunk/maven-site-plugin/src/test/java/org/apache/maven/plugins/site/stubs/SiteMavenProjectStub.java   (with props)
    maven/plugins/trunk/maven-site-plugin/src/test/resources/
    maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/
    maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/
    maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/pom.xml   (with props)
    maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/src/
    maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/src/site/
    maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/src/site/apt/
    maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/src/site/apt/test.apt   (with props)
    maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/src/site/site.xml   (with props)
Modified:
    maven/plugins/trunk/maven-site-plugin/   (props changed)
    maven/plugins/trunk/maven-site-plugin/pom.xml
    maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java
    maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java
    maven/plugins/trunk/maven-site-plugin/src/site/apt/examples/sitedescriptor.apt

Propchange: maven/plugins/trunk/maven-site-plugin/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sat Nov 11 10:47:55 2006
@@ -9,3 +9,4 @@
 *.iws
 *.iml
 .wtpmodules
+cobertura.ser

Modified: maven/plugins/trunk/maven-site-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/pom.xml?view=diff&rev=473770&r1=473769&r2=473770
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-site-plugin/pom.xml Sat Nov 11 10:47:55 2006
@@ -1,3 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Copyright 2004-2006 The Apache Software Foundation.
+  ~
+  ~ Licensed 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 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/maven-v4_0_0.xsd">
   <parent>
     <artifactId>maven-plugins</artifactId>
@@ -103,6 +121,12 @@
       <groupId>org.mortbay.jetty</groupId>
       <artifactId>jetty</artifactId>
       <version>6.0.0rc0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.shared</groupId>
+      <artifactId>maven-plugin-testing-harness</artifactId>
+      <version>1.0-beta-1</version>
+      <scope>test</scope>
     </dependency>
   </dependencies>
 </project>

Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java?view=diff&rev=473770&r1=473769&r2=473770
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java (original)
+++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java Sat Nov 11 10:47:55 2006
@@ -29,8 +29,13 @@
 import org.apache.maven.reporting.MavenReport;
 import org.codehaus.plexus.i18n.I18N;
 import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.interpolation.EnvarBasedValueSource;
+import org.codehaus.plexus.util.interpolation.MapBasedValueSource;
+import org.codehaus.plexus.util.interpolation.ObjectBasedValueSource;
+import org.codehaus.plexus.util.interpolation.RegexBasedInterpolator;
 
 import java.io.File;
+import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
@@ -241,6 +246,7 @@
     /**
      * Get the path of the site descriptor for a given locale.
      *
+     * @param basedir the base dir
      * @param locale the locale
      * @return the site descriptor path
      */
@@ -516,6 +522,14 @@
         }
         catch ( MalformedURLException e )
         {
+            try
+            {
+                toUrl = new File( to ).toURL();
+            }
+            catch ( MalformedURLException e1 )
+            {
+                getLog().warn( "Unable to load an URL for '" + to + "': " + e.getMessage() );
+            }
         }
 
         try
@@ -524,6 +538,14 @@
         }
         catch ( MalformedURLException e )
         {
+            try
+            {
+                toUrl = new File( from ).toURL();
+            }
+            catch ( MalformedURLException e1 )
+            {
+                getLog().warn( "Unable to load an URL for '" + from + "': " + e.getMessage() );
+            }
         }
 
         if ( toUrl != null && fromUrl != null )
@@ -733,14 +755,14 @@
      * <p/>
      * TODO: once bug is fixed in Maven proper, remove this
      *
-     * @param project
+     * @param aProject
      * @return parent project URL.
      */
-    protected MavenProject getParentProject( MavenProject project )
+    protected MavenProject getParentProject( MavenProject aProject )
     {
         MavenProject parentProject = null;
 
-        MavenProject origParent = project.getParent();
+        MavenProject origParent = aProject.getParent();
         if ( origParent != null )
         {
             Iterator reactorItr = reactorProjects.iterator();
@@ -758,12 +780,12 @@
                 }
             }
 
-            if ( parentProject == null && project.getBasedir() != null )
+            if ( parentProject == null && aProject.getBasedir() != null )
             {
                 try
                 {
                     MavenProject mavenProject = mavenProjectBuilder.build(
-                        new File( project.getBasedir(), project.getModel().getParent().getRelativePath() ),
+                        new File( aProject.getBasedir(), aProject.getModel().getParent().getRelativePath() ),
                         localRepository, null );
                     if ( mavenProject.getGroupId().equals( origParent.getGroupId() ) &&
                         mavenProject.getArtifactId().equals( origParent.getArtifactId() ) &&
@@ -782,8 +804,8 @@
             {
                 try
                 {
-                    parentProject = mavenProjectBuilder.buildFromRepository( project.getParentArtifact(),
-                                                                             project.getRemoteArtifactRepositories(),
+                    parentProject = mavenProjectBuilder.buildFromRepository( aProject.getParentArtifact(),
+                                                                             aProject.getRemoteArtifactRepositories(),
                                                                              localRepository );
                 }
                 catch ( ProjectBuildingException e )
@@ -802,30 +824,48 @@
         return parentProject;
     }
 
-    protected String getInterpolatedSiteDescriptorContent( Map props, MavenProject project, String siteDescriptorContent )
-    {
-        props.put( "inputEncoding", inputEncoding );
-        props.put( "outputEncoding", outputEncoding );
-
-        // TODO: interpolate ${project.*} in general
+    /**
+     * Interporlating several expressions in the site descriptor content. Actually, the expressions could be on
+     * the project, the environment variables and the specific properties like <code>encoding</code>.
+     * <p/>
+     * For instance:
+     * <dl>
+     * <dt>${project.name}</dt>
+     * <dd>The value from the POM of:
+     * <p>
+     * &lt;project&gt;<br>
+     * &lt;name&gt;myProjectName&lt;/name&gt;<br>
+     * &lt;/project&gt;
+     * </p></dd>
+     * <dt>${my.value}</dt>
+     * <dd>The value from the POM of:
+     * <p>
+     * &lt;properties&gt;<br>
+     * &lt;my.value&gt;hello&lt;/my.value&gt;<br>
+     * &lt;/properties&gt;
+     * </p></dd>
+     * <dt>${JAVA_HOME}</dt>
+     * <dd>The value of JAVA_HOME in the environment variables</dd>
+     * </dl>
+     *
+     * @param props
+     * @param aProject
+     * @param siteDescriptorContent
+     * @return the site descriptor content with interpolate string
+     * @throws IOException
+     */
+    protected String getInterpolatedSiteDescriptorContent( Map props, MavenProject aProject, String siteDescriptorContent )
+        throws IOException
+    {
+        RegexBasedInterpolator interpolator = new RegexBasedInterpolator();
+        interpolator.addValueSource( new EnvarBasedValueSource() );
+        interpolator.addValueSource( new ObjectBasedValueSource( aProject ) );
+        interpolator.addValueSource( new MapBasedValueSource( aProject.getProperties() ) );
 
-        if ( project.getName() != null )
-        {
-            props.put( "project.name", project.getName() );
-        }
-        else
-        {
-            props.put( "project.name", "NO_PROJECT_NAME_SET" );
-        }
+        siteDescriptorContent = interpolator.interpolate( siteDescriptorContent, "project" );
 
-        if ( project.getUrl() != null )
-        {
-            props.put( "project.url", project.getUrl() );
-        }
-        else
-        {
-            props.put( "project.url", "NO_PROJECT_URL_SET_" + project.getId() );
-        }
+        props.put( "inputEncoding", inputEncoding );
+        props.put( "outputEncoding", outputEncoding );
 
         // Legacy for the old ${parentProject} syntax
         props.put( "parentProject", "<menu ref=\"parent\"/>" );

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?view=diff&rev=473770&r1=473769&r2=473770
==============================================================================
--- 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 Sat Nov 11 10:47:55 2006
@@ -39,7 +39,6 @@
 import org.apache.maven.reporting.MavenReport;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
 import java.io.File;
@@ -207,7 +206,15 @@
         DecorationModel decoration = null;
         if ( siteDescriptorContent != null )
         {
-            siteDescriptorContent = getInterpolatedSiteDescriptorContent( props, project, siteDescriptorContent );
+            try
+            {
+                siteDescriptorContent = getInterpolatedSiteDescriptorContent( props, project, siteDescriptorContent );
+            }
+            catch ( IOException e )
+            {
+                throw new MojoExecutionException(
+                                                 "The site descriptor cannot interpolated properties: " + e.getMessage(), e );
+            }
 
             decoration = readDecorationModel( siteDescriptorContent );
         }
@@ -506,7 +513,15 @@
                 throw new MojoExecutionException( "Error reading default site descriptor: " + e.getMessage(), e );
             }
 
-            siteDescriptorContent = getInterpolatedSiteDescriptorContent( props, project, siteDescriptorContent );
+            try
+            {
+                siteDescriptorContent = getInterpolatedSiteDescriptorContent( props, project, siteDescriptorContent );
+            }
+            catch ( IOException e )
+            {
+                throw new MojoExecutionException(
+                                                 "The site descriptor cannot interpolated properties: " + e.getMessage(), e );
+            }
 
             decorationModel = readDecorationModel( siteDescriptorContent );
         }
@@ -632,8 +647,6 @@
         }
         return documents;
     }
-
-
 }
 
 

Modified: maven/plugins/trunk/maven-site-plugin/src/site/apt/examples/sitedescriptor.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/site/apt/examples/sitedescriptor.apt?view=diff&rev=473770&r1=473769&r2=473770
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/site/apt/examples/sitedescriptor.apt (original)
+++ maven/plugins/trunk/maven-site-plugin/src/site/apt/examples/sitedescriptor.apt Sat Nov 11 10:47:55 2006
@@ -5,7 +5,7 @@
  <vi...@gmail.com>
  Maria Odea Ching
  ------
- July 2006
+ November 2006
  ------
 
  ~~ Copyright 2006 The Apache Software Foundation.
@@ -64,7 +64,7 @@
   <menu name="Common Links" inherit="top">
     ...
   </menu>
- ....
+ ...
 +-----+
 
 * Including Generated Content
@@ -83,7 +83,7 @@
 +-----+
  ...
   <menu ref="modules" />
- ....
+ ...
 +-----+
 
 * Skinning
@@ -100,7 +100,7 @@
     <artifactId>maven-classic-skin</artifactId>
     <version>1.0</version>
   </skin>
- ....
+ ...
 +-----+
 
   Note that the version is optional and, like plugins, if omitted the latest version available will be used.
@@ -108,3 +108,15 @@
   This skin will copy the necessary resources including CSS and if necessary use the included alternate Velocity
   template to render the site.
 
+* Expressions
+
+  The <<<site.xml>>> could contained some expressions, like <<<$\{project.name\}>>>. Each expression will be
+  evaluated when site rendering.
+
+  Expressions could be:
+
+  * $\{project.*\}, for instance <<<$\{project.organization.name\}>>> referenced in <<< <project/><organization/><name/> >>>
+
+  * $\{project.properties\}, for instance <<<$\{myProperty\}>>> referenced in <<< <project/><properties/><myProperty/> >>>
+
+  * $\{environmentVariable\}, for instance <<<$\{JAVA_HOME\}>>>

Added: maven/plugins/trunk/maven-site-plugin/src/test/java/org/apache/maven/plugins/site/SiteMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/test/java/org/apache/maven/plugins/site/SiteMojoTest.java?view=auto&rev=473770
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/test/java/org/apache/maven/plugins/site/SiteMojoTest.java (added)
+++ maven/plugins/trunk/maven-site-plugin/src/test/java/org/apache/maven/plugins/site/SiteMojoTest.java Sat Nov 11 10:47:55 2006
@@ -0,0 +1,60 @@
+package org.apache.maven.plugins.site;
+
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.File;
+import java.util.HashMap;
+
+import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+import org.codehaus.plexus.util.FileUtils;
+
+/**
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @version $Id$
+ */
+public class SiteMojoTest
+    extends AbstractMojoTestCase
+{
+    /**
+     * Test method for 'org.apache.maven.plugins.site.AbstractSiteMojo.getInterpolatedSiteDescriptorContent(Map, MavenProject, String)'
+     *
+     * @throws Exception
+     */
+    public void testGetInterpolatedSiteDescriptorContent()
+        throws Exception
+    {
+        File pluginXmlFile = getTestFile( "src/test/resources/unit/interpolated-site/pom.xml" );
+        assertNotNull( pluginXmlFile );
+        assertTrue( pluginXmlFile.exists() );
+
+        SiteMojo siteMojo = (SiteMojo) lookupMojo( "site", pluginXmlFile );
+        assertNotNull( siteMojo );
+
+        File descriptorFile = getTestFile( "src/test/resources/unit/interpolated-site/src/site/site.xml" );
+        assertNotNull( descriptorFile );
+        assertTrue( descriptorFile.exists() );
+
+        String siteDescriptorContent = FileUtils.fileRead( descriptorFile );
+        assertNotNull( siteDescriptorContent );
+        assertTrue( siteDescriptorContent.indexOf( "${project.name}" ) != -1 );
+
+        siteDescriptorContent = siteMojo.getInterpolatedSiteDescriptorContent( new HashMap(), siteMojo.project,
+                                                                               siteDescriptorContent );
+        assertNotNull( siteDescriptorContent );
+        assertTrue( siteDescriptorContent.indexOf( "${project.name}" ) == -1 );
+    }
+}

Propchange: maven/plugins/trunk/maven-site-plugin/src/test/java/org/apache/maven/plugins/site/SiteMojoTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-site-plugin/src/test/java/org/apache/maven/plugins/site/SiteMojoTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/trunk/maven-site-plugin/src/test/java/org/apache/maven/plugins/site/stubs/SiteMavenProjectStub.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/test/java/org/apache/maven/plugins/site/stubs/SiteMavenProjectStub.java?view=auto&rev=473770
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/test/java/org/apache/maven/plugins/site/stubs/SiteMavenProjectStub.java (added)
+++ maven/plugins/trunk/maven-site-plugin/src/test/java/org/apache/maven/plugins/site/stubs/SiteMavenProjectStub.java Sat Nov 11 10:47:55 2006
@@ -0,0 +1,66 @@
+package org.apache.maven.plugins.site.stubs;
+
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.File;
+import java.io.FileReader;
+import java.util.Properties;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+
+/**
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @version $Id$
+ */
+public class SiteMavenProjectStub
+    extends MavenProjectStub
+{
+    public SiteMavenProjectStub()
+    {
+        MavenXpp3Reader pomReader = new MavenXpp3Reader();
+        Model model = null;
+
+        try
+        {
+            model = pomReader.read( new FileReader( new File( getBasedir(),
+                                                              "/src/test/resources/unit/interpolated-site/pom.xml" ) ) );
+            setModel( model );
+        }
+        catch ( Exception e )
+        {
+            throw new RuntimeException( e );
+        }
+    }
+
+    /**
+     * @see org.apache.maven.project.MavenProject#getName()
+     */
+    public String getName()
+    {
+        return getModel().getName();
+    }
+
+    /**
+     * @see org.apache.maven.project.MavenProject#getProperties()
+     */
+    public Properties getProperties()
+    {
+        return new Properties();
+    }
+}

Propchange: maven/plugins/trunk/maven-site-plugin/src/test/java/org/apache/maven/plugins/site/stubs/SiteMavenProjectStub.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-site-plugin/src/test/java/org/apache/maven/plugins/site/stubs/SiteMavenProjectStub.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/pom.xml?view=auto&rev=473770
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/pom.xml (added)
+++ maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/pom.xml Sat Nov 11 10:47:55 2006
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!--
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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 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/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.plugin.site.unit</groupId>
+  <artifactId>interpolatesite</artifactId>
+  <packaging>jar</packaging>
+  <version>1.0-SNAPSHOT</version>
+  <inceptionYear>2006</inceptionYear>
+  <name>Interpolatesite</name>
+  <description>Test interpolation for site.xml.</description>
+  <url>http://maven.apache.org</url>
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  <developers>
+    <developer>
+      <id>vsiveton</id>
+      <name>Vincent Siveton</name>
+      <email>vsiveton@apache.org</email>
+      <organization>Apache Software Foundation</organization>
+      <roles>
+        <role>Java Developer</role>
+      </roles>
+      <timezone>-5</timezone>
+    </developer>
+  </developers>
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-project-info-reports-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </reporting>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-site-plugin</artifactId>
+        <configuration>
+          <project implementation="org.apache.maven.plugins.site.stubs.SiteMavenProjectStub"/>
+          <inputEncoding>ISO-8859-1</inputEncoding>
+          <outputEncoding>ISO-8859-1</outputEncoding>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/src/site/apt/test.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/src/site/apt/test.apt?view=auto&rev=473770
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/src/site/apt/test.apt (added)
+++ maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/src/site/apt/test.apt Sat Nov 11 10:47:55 2006
@@ -0,0 +1,12 @@
+ ------
+ Configuring Site Plugin
+ ------
+ Vincent Siveton
+ ------
+ November 2006
+ ------
+
+
+Site Plugin Test
+
+ Test

Propchange: maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/src/site/apt/test.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/src/site/apt/test.apt
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/src/site/site.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/src/site/site.xml?view=auto&rev=473770
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/src/site/site.xml (added)
+++ maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/src/site/site.xml Sat Nov 11 10:47:55 2006
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!--
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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="Maven Site">
+  <bannerLeft>
+    <name>Maven Site</name>
+    <src>http://maven.apache.org/images/apache-maven-project.png</src>
+    <href>http://maven.apache.org/</href>
+  </bannerLeft>
+  <bannerRight>
+    <src>http://maven.apache.org/images/maven-small.gif</src>
+  </bannerRight>
+  <body>
+    <links>
+      <item name="Maven" href="http://maven.apache.org/"/>
+    </links>
+
+    <menu name="Overview">
+      <item name="Test" href="/test.html"/>
+      <item name="Test ${project.name}" href="/test.html"/>
+      <item name="Test ${JAVA_HOME}" href="/test.html"/>
+    </menu>
+    ${reports}
+  </body>
+</project>

Propchange: maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/src/site/site.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-site-plugin/src/test/resources/unit/interpolated-site/src/site/site.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



Re: svn commit: r473770 - in /maven/plugins/trunk/maven-site-plugin: ./ src/main/java/org/apache/maven/plugins/site/ src/site/apt/examples/ src/test/java/ src/test/java/org/ src/test/java/org/apache/ src/test/java/org/apache/maven/ src/test/java/org/apache...

Posted by Brett Porter <br...@apache.org>.
Hi Vincent,

Thanks for this! I think there was a JIRA for the general case which  
you might want to close as being superceded by the other one too.

I have a couple of comments unrelated to the main change:

On 12/11/2006, at 5:47 AM, vsiveton@apache.org wrote:

>          }
>          catch ( MalformedURLException e )
>          {
> +            try
> +            {
> +                toUrl = new File( to ).toURL();
> +            }
> +            catch ( MalformedURLException e1 )
> +            {
> +                getLog().warn( "Unable to load an URL for '" + to  
> + "': " + e.getMessage() );
> +            }
>          }

I'm not quite sure what these would do - why would the URL be given  
as a file?

> -    protected MavenProject getParentProject( MavenProject project )
> +    protected MavenProject getParentProject( MavenProject aProject )

Just a nitpick - can you avoid making unrelated changes like this  
(which only changed the variable name), as it puts a lot of noise  
into the diff? Thanks :)

Cheers,
Brett


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org