You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2010/10/07 14:52:44 UTC

svn commit: r1005434 - in /maven/plugins/branches/maven-site-plugin-3.x/src: it/MSITE-304/ it/MSITE-484/ it/MSITE-512/ it/MSITE-512/parent-usage-test/ it/MSITE-512/parent-usage-test/src/main/java/org/ it/MSITE-512/parent-usage-test/src/main/java/org/ap...

Author: olamy
Date: Thu Oct  7 12:52:44 2010
New Revision: 1005434

URL: http://svn.apache.org/viewvc?rev=1005434&view=rev
Log:
[MSITE-512] Configuration of m-javadoc-p at reportSet level is not taken into account.


Added:
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/
      - copied from r1005219, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-484/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/parent-usage-test/src/main/java/org/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/parent-usage-test/src/main/java/org/apache/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/parent-usage-test/src/main/java/org/apache/maven/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/parent-usage-test/src/main/java/org/apache/maven/titi/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/parent-usage-test/src/main/java/org/apache/maven/titi/AppFoo.java   (with props)
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/parent-usage-test/src/main/java/org/apache/maven/toto/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/parent-usage-test/src/main/java/org/apache/maven/toto/App.java   (with props)
Modified:
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-304/pom.xml
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-484/verify.groovy
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/parent-usage-test/pom.xml
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/pom.xml
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/verify.groovy
    maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/DefaultMavenReportExecutor.java
    maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportPlugin.java

Modified: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-304/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-304/pom.xml?rev=1005434&r1=1005433&r2=1005434&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-304/pom.xml (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-304/pom.xml Thu Oct  7 12:52:44 2010
@@ -43,6 +43,7 @@ under the License.
     <pluginManagement>
       <plugins>
         <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-site-plugin</artifactId>
           <version>@project.version@</version>
         </plugin>

Modified: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-484/verify.groovy
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-484/verify.groovy?rev=1005434&r1=1005433&r2=1005434&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-484/verify.groovy (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-484/verify.groovy Thu Oct  7 12:52:44 2010
@@ -25,5 +25,4 @@ assert new File(basedir, 'parent-usage-t
 assert new File(basedir, 'parent-usage-test/target/site/issue-tracking.html').exists();
 assert new File(basedir, 'parent-usage-test/target/site/apidocs').exists();
 
-
 return true;
\ No newline at end of file

Modified: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/parent-usage-test/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/parent-usage-test/pom.xml?rev=1005434&r1=1005219&r2=1005434&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/parent-usage-test/pom.xml (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/parent-usage-test/pom.xml Thu Oct  7 12:52:44 2010
@@ -1,14 +1,14 @@
 <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>
-  <artifactId>parent-usage-test</artifactId>
+  <artifactId>parent-usage-test-MSITE-512</artifactId>
   <packaging>jar</packaging>
   <version>1.0-SNAPSHOT</version>
   <name>parent-usage-test</name>
   <url>http://url</url>
   <parent>
     <groupId>test</groupId>
-    <artifactId>parent</artifactId>
+    <artifactId>parent-MSITE-512</artifactId>
     <version>1.0-SNAPSHOT</version>
     <relativePath>../pom.xml</relativePath>
   </parent>
@@ -26,33 +26,42 @@
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-site-plugin</artifactId>
         <version>@project.version@</version>
-        <configuration>
-          <reportPlugins combine.children="append">
-            <!-- Adding an additional plugin -->
-            <plugin>
-              <groupId>org.apache.maven.plugins</groupId>
-              <artifactId>maven-jxr-plugin</artifactId>
-              <version>2.1</version>
-            </plugin>
-            <!-- Overriding an inherited plugin -->
-            <plugin>
-              <groupId>org.apache.maven.plugins</groupId>
-              <artifactId>maven-javadoc-plugin</artifactId>
-              <version>2.6.1</version>
-              <configuration>
-                <stylesheetfile>${basedir}/src/main/javadoc/stylesheet.css</stylesheetfile>
-              </configuration>
-              <reportSets>
-                <reportSet>
-                  <reports>
-                    <report>javadoc</report>
-                  </reports>
-                </reportSet>
-              </reportSets>
-            </plugin>
-          </reportPlugins>
-        </configuration>
       </plugin>
+      
     </plugins>
   </build>
+  
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <version>2.7</version>
+        <reportSets>
+          <reportSet>
+            <id>single</id>
+            <configuration>
+              <excludePackageNames>org.apache.maven.titi</excludePackageNames>
+              <groups>
+                <group>
+                  <title>Core Packages</title>
+                  <packages>org.apache.maven.toto</packages>
+                </group>
+              </groups>
+            </configuration>
+            <reports>
+              <report>javadoc</report>
+            </reports>
+          </reportSet>
+        </reportSets>
+      </plugin>    
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jxr-plugin</artifactId>
+        <version>2.1</version>
+      </plugin>
+    
+    </plugins>  
+  </reporting>
+  
 </project>

Added: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/parent-usage-test/src/main/java/org/apache/maven/titi/AppFoo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/parent-usage-test/src/main/java/org/apache/maven/titi/AppFoo.java?rev=1005434&view=auto
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/parent-usage-test/src/main/java/org/apache/maven/titi/AppFoo.java (added)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/parent-usage-test/src/main/java/org/apache/maven/titi/AppFoo.java Thu Oct  7 12:52:44 2010
@@ -0,0 +1,12 @@
+package org.apache.maven.titi;
+/**
+ * Hello world!
+ *
+ */
+public class AppFoo 
+{
+    public static void main( String[] args )
+    {
+        System.out.println( "Hello World!" );
+    }
+}

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/parent-usage-test/src/main/java/org/apache/maven/titi/AppFoo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/parent-usage-test/src/main/java/org/apache/maven/titi/AppFoo.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/parent-usage-test/src/main/java/org/apache/maven/toto/App.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/parent-usage-test/src/main/java/org/apache/maven/toto/App.java?rev=1005434&view=auto
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/parent-usage-test/src/main/java/org/apache/maven/toto/App.java (added)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/parent-usage-test/src/main/java/org/apache/maven/toto/App.java Thu Oct  7 12:52:44 2010
@@ -0,0 +1,12 @@
+package org.apache.maven.toto;
+/**
+ * Hello world!
+ *
+ */
+public class App 
+{
+    public static void main( String[] args )
+    {
+        System.out.println( "Hello World!" );
+    }
+}

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/parent-usage-test/src/main/java/org/apache/maven/toto/App.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/parent-usage-test/src/main/java/org/apache/maven/toto/App.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/pom.xml?rev=1005434&r1=1005219&r2=1005434&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/pom.xml (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/pom.xml Thu Oct  7 12:52:44 2010
@@ -2,7 +2,7 @@
   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>test</groupId>
-  <artifactId>parent</artifactId>
+  <artifactId>parent-MSITE-512</artifactId>
   <packaging>pom</packaging>
   <version>1.0-SNAPSHOT</version>
   <name>parent</name>
@@ -13,41 +13,6 @@
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-site-plugin</artifactId>
         <version>@project.version@</version>
-        <configuration>
-          <reportPlugins>
-            <plugin>
-              <groupId>org.apache.maven.plugins</groupId>
-              <artifactId>maven-project-info-reports-plugin</artifactId>
-              <version>2.2</version>
-              <configuration>
-                <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
-              </configuration>
-              <reportSets>
-                <reportSet>
-                  <reports>
-                    <report>summary</report>
-                    <report>index</report>
-                    <report>cim</report>
-                    <report>issue-tracking</report>
-                    <report>scm</report>
-                  </reports>
-                </reportSet>
-              </reportSets>
-            </plugin>
-            <plugin>
-              <groupId>org.apache.maven.plugins</groupId>
-              <artifactId>maven-javadoc-plugin</artifactId>
-              <version>2.6.1</version>
-              <reportSets>
-                <reportSet>
-                  <reports>
-                    <report>javadoc</report>
-                  </reports>
-                </reportSet>
-              </reportSets>
-            </plugin>
-          </reportPlugins>
-        </configuration>
       </plugin>
     </plugins>
   </build>
@@ -55,4 +20,7 @@
   <modules>
     <module>parent-usage-test</module>
   </modules>
+  <reporting>
+    <excludeDefaults>true</excludeDefaults>
+  </reporting>
 </project>

Modified: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/verify.groovy
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/verify.groovy?rev=1005434&r1=1005219&r2=1005434&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/verify.groovy (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-512/verify.groovy Thu Oct  7 12:52:44 2010
@@ -18,12 +18,11 @@
  * under the License.
  */
 
-assert new File(basedir, 'target/site/issue-tracking.html').exists();
-
 assert new File(basedir, 'parent-usage-test/target/site/xref/index.html').exists();
 assert new File(basedir, 'parent-usage-test/target/site/xref-test/index.html').exists();
-assert new File(basedir, 'parent-usage-test/target/site/issue-tracking.html').exists();
 assert new File(basedir, 'parent-usage-test/target/site/apidocs').exists();
 
+assert new File(basedir, 'parent-usage-test/target/site/apidocs').exists();
+assert !new File(basedir, 'parent-usage-test/target/site/apidocs/org/apache/maven/titi/AppFoo.html').exists();
 
 return true;
\ No newline at end of file

Modified: maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/DefaultMavenReportExecutor.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/DefaultMavenReportExecutor.java?rev=1005434&r1=1005433&r2=1005434&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/DefaultMavenReportExecutor.java (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/DefaultMavenReportExecutor.java Thu Oct  7 12:52:44 2010
@@ -21,16 +21,19 @@ package org.apache.maven.plugins.site;
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Set;
+import java.util.TreeMap;
 
 import org.apache.maven.artifact.repository.DefaultRepositoryRequest;
 import org.apache.maven.artifact.repository.RepositoryRequest;
 import org.apache.maven.artifact.resolver.filter.ExclusionSetFilter;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.lifecycle.LifecycleExecutor;
-import org.apache.maven.model.Model;
 import org.apache.maven.model.Plugin;
 import org.apache.maven.plugin.MavenPluginManager;
 import org.apache.maven.plugin.Mojo;
@@ -129,10 +132,15 @@ public class DefaultMavenReportExecutor
     public List<MavenReportExecution> buildMavenReports( MavenReportExecutorRequest mavenReportExecutorRequest )
         throws MojoExecutionException
     {
+        if (mavenReportExecutorRequest.getReportPlugins() == null)
+        {
+            return Collections.emptyList();
+        }
         if ( getLog().isDebugEnabled() )
         {
             getLog().debug( "DefaultMavenReportExecutor.buildMavenReports()" );
         }
+        
         ExclusionsDependencyFilter exclusionSetFilter = new ExclusionsDependencyFilter( EXCLUDES );
 
         RepositoryRequest repositoryRequest = new DefaultRepositoryRequest();
@@ -141,6 +149,8 @@ public class DefaultMavenReportExecutor
 
         MavenSession session = mavenReportExecutorRequest.getMavenSession();
         
+        List<String> reportPluginKeys = new ArrayList<String>(mavenReportExecutorRequest.getReportPlugins().length);
+        
         try
         {
             List<MavenReportExecution> reports = new ArrayList<MavenReportExecution>();
@@ -150,6 +160,16 @@ public class DefaultMavenReportExecutor
                 Plugin plugin = new Plugin();
                 plugin.setGroupId( reportPlugin.getGroupId() );
                 plugin.setArtifactId( reportPlugin.getArtifactId() );
+                String pluginKey = reportPlugin.getGroupId() + ":" + reportPlugin.getArtifactId();
+                if ( reportPluginKeys.contains( pluginKey ) )
+                {
+                    getLog().info( "plugin " + pluginKey + " will be executed more than one time" );
+                }
+                else
+                {
+                    reportPluginKeys.add( pluginKey );
+                }
+                    
                 plugin.setVersion( getPluginVersion( reportPlugin, repositoryRequest, mavenReportExecutorRequest ) );
                 mergePluginToReportPlugin( mavenReportExecutorRequest, plugin, reportPlugin );
                
@@ -158,7 +178,7 @@ public class DefaultMavenReportExecutor
                     logger.info( "configuring report plugin " + plugin.getId() );
                 }
 
-                Set<String> goals = new HashSet<String>();
+                Map<String, PlexusConfiguration> goalsWithConfiguration = new TreeMap<String, PlexusConfiguration>();
 
                 List<RemoteRepository> remoteRepositories = session.getCurrentProject().getRemotePluginRepositories();
                
@@ -170,7 +190,7 @@ public class DefaultMavenReportExecutor
                     List<MojoDescriptor> mojoDescriptors = pluginDescriptor.getMojos();
                     for ( MojoDescriptor mojoDescriptor : mojoDescriptors )
                     {
-                        goals.add( mojoDescriptor.getGoal() );
+                        goalsWithConfiguration.put( mojoDescriptor.getGoal(), mojoDescriptor.getConfiguration() );
                     }
                 }
                 else
@@ -179,33 +199,45 @@ public class DefaultMavenReportExecutor
                     {
                         for ( ReportSet reportSet : reportPlugin.getReportSets() )
                         {
-                            goals.addAll( reportSet.getReports() );
+                            for (String report : reportSet.getReports())
+                            {
+                                goalsWithConfiguration.put( report, reportSet.getConfiguration() );
+                            }
                         }
                     }
                     if ( !reportPlugin.getReports().isEmpty() )
                     {
-                        goals.addAll( reportPlugin.getReports() );
+                        for (String report : reportPlugin.getReports())
+                        {
+                            goalsWithConfiguration.put( report, reportPlugin.getConfiguration() );
+                        }
                     }
                 }
 
-                for ( String goal : goals )
+                for ( Entry<String, PlexusConfiguration> entry : goalsWithConfiguration.entrySet() )
                 {
-                    MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( goal );
+                    MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( entry.getKey() );
                     if ( mojoDescriptor == null )
                     {
-                        throw new MojoNotFoundException( goal, pluginDescriptor );
+                        throw new MojoNotFoundException(  entry.getKey(), pluginDescriptor );
                     }
 
-                    MojoExecution mojoExecution = new MojoExecution( plugin, goal, "report:" + goal );
+                    MojoExecution mojoExecution = new MojoExecution( plugin,  entry.getKey(), "report:" +  entry.getKey() );
 
                     mojoExecution.setConfiguration( convert( mojoDescriptor ) );
                     
-                    if ( reportPlugin.getConfiguration() != null )
+                    if ( reportPlugin.getConfiguration() != null || entry.getValue() != null )
                     {
-                        Xpp3Dom reportConfiguration = convert( reportPlugin.getConfiguration() );
+                        Xpp3Dom reportConfiguration = reportPlugin.getConfiguration() == null ? new Xpp3Dom( "fake" )
+                                                                                             : convert( reportPlugin
+                                                                                                 .getConfiguration() );
+
+                        // MSITE-512 configuration from ReportSet must win
+                        Xpp3Dom mergedConfigurationWithReportSet = Xpp3DomUtils
+                            .mergeXpp3Dom( convert( entry.getValue() ), reportConfiguration );
 
-                        Xpp3Dom mergedConfiguration =
-                            Xpp3DomUtils.mergeXpp3Dom( reportConfiguration, convert( mojoDescriptor ) );
+                        Xpp3Dom mergedConfiguration = Xpp3DomUtils.mergeXpp3Dom( mergedConfigurationWithReportSet,
+                                                                                 convert( mojoDescriptor ) );
 
                         Xpp3Dom cleanedConfiguration = new Xpp3Dom( "configuration" );
                         if ( mergedConfiguration.getChildren() != null )
@@ -549,6 +581,7 @@ public class DefaultMavenReportExecutor
     private void mergePluginToReportPlugin( MavenReportExecutorRequest mavenReportExecutorRequest, Plugin buildPlugin,
                                             ReportPlugin reportPlugin )
     {
+ 
         Plugin configuredPlugin = find( reportPlugin, mavenReportExecutorRequest.getProject().getBuild().getPlugins() );
         if ( configuredPlugin != null )
         {
@@ -557,5 +590,6 @@ public class DefaultMavenReportExecutor
                 buildPlugin.getDependencies().addAll( configuredPlugin.getDependencies() );
             }
         }
-    }
+    }   
+    
 }

Modified: maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportPlugin.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportPlugin.java?rev=1005434&r1=1005433&r2=1005434&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportPlugin.java (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportPlugin.java Thu Oct  7 12:52:44 2010
@@ -113,4 +113,6 @@ public class ReportPlugin
         this.reports = reports;
     }
 
+    
+
 }