You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2009/09/04 01:14:36 UTC

svn commit: r811169 - in /maven/plugins/branches/maven-site-plugin-3.x/src: it/empty-report-set/ it/empty-report-set/pom.xml it/empty-report-set/verify.bsh main/java/org/apache/maven/plugins/site/DefaultMavenReportExecutor.java

Author: bentmann
Date: Thu Sep  3 23:14:35 2009
New Revision: 811169

URL: http://svn.apache.org/viewvc?rev=811169&view=rev
Log:
o Fixed handling of empty report sets

Added:
    maven/plugins/branches/maven-site-plugin-3.x/src/it/empty-report-set/   (with props)
    maven/plugins/branches/maven-site-plugin-3.x/src/it/empty-report-set/pom.xml   (with props)
    maven/plugins/branches/maven-site-plugin-3.x/src/it/empty-report-set/verify.bsh   (with props)
Modified:
    maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/DefaultMavenReportExecutor.java

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/empty-report-set/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Thu Sep  3 23:14:35 2009
@@ -0,0 +1 @@
+MSITE-\d+

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/empty-report-set/
------------------------------------------------------------------------------
    bugtraq:url = http://jira.codehaus.org/browse/%BUGID%

Added: maven/plugins/branches/maven-site-plugin-3.x/src/it/empty-report-set/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/it/empty-report-set/pom.xml?rev=811169&view=auto
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/it/empty-report-set/pom.xml (added)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/it/empty-report-set/pom.xml Thu Sep  3 23:14:35 2009
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.site</groupId>
+  <artifactId>test</artifactId>
+  <version>0.1</version>
+  <packaging>jar</packaging>
+
+  <name>Test</name>
+  <description>
+    Test that an empty report set disables the default reports.
+  </description>
+  <url>http://maven.apache.org/</url>
+
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-site-plugin</artifactId>
+        <version>@project.version@</version>
+      </plugin>
+    </plugins>
+  </build>
+
+  <reporting>
+    <plugins>
+      <plugin>
+        <artifactId>maven-project-info-reports-plugin</artifactId>
+        <version>2.1.1</version>
+        <reportSets>
+          <!-- this should suppress the default reports -->
+          <reportSet/>
+        </reportSets>
+      </plugin>
+    </plugins>
+  </reporting>
+
+</project>

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/empty-report-set/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/empty-report-set/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/branches/maven-site-plugin-3.x/src/it/empty-report-set/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/it/empty-report-set/verify.bsh?rev=811169&view=auto
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/it/empty-report-set/verify.bsh (added)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/it/empty-report-set/verify.bsh Thu Sep  3 23:14:35 2009
@@ -0,0 +1,8 @@
+import java.io.*;
+
+File indexHtml = new File( basedir, "target/site/index.html" );
+
+if ( indexHtml.exists() )
+{
+    throw new Exception( "Detected unwanted file " + indexHtml );
+}

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/empty-report-set/verify.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/empty-report-set/verify.bsh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

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=811169&r1=811168&r2=811169&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 Sep  3 23:14:35 2009
@@ -91,16 +91,10 @@
                 plugin.setVersion( reportPlugin.getVersion() );
 
                 List<String> goals = new ArrayList<String>();
-                for ( ReportSet reportSet : reportPlugin.getReportSets() )
-                {
-                    goals.addAll( reportSet.getReports() );
-                }
-                // no report set we will execute all from the report plugin
-                boolean emptyReports = goals.isEmpty();
 
                 PluginDescriptor pluginDescriptor = mavenPluginManager.getPluginDescriptor( plugin, repositoryRequest );
 
-                if ( emptyReports )
+                if ( reportPlugin.getReportSets().isEmpty() )
                 {
                     List<MojoDescriptor> mojoDescriptors = pluginDescriptor.getMojos();
                     for ( MojoDescriptor mojoDescriptor : mojoDescriptors )
@@ -108,6 +102,13 @@
                         goals.add( mojoDescriptor.getGoal() );
                     }
                 }
+                else
+                {
+                    for ( ReportSet reportSet : reportPlugin.getReportSets() )
+                    {
+                        goals.addAll( reportSet.getReports() );
+                    }
+                }
 
                 for ( String goal : goals )
                 {