Author: bimargulies
Date: Tue Aug 23 18:12:48 2011
New Revision: 1160829

URL: http://svn.apache.org/viewvc?rev=1160829&view=rev
Log:
[JXR-93] aggregate goal creates blank top-level report

o The pattern for using this aggregate goals is to put a plain old execution in 
the plain old build section.
This requires an 'execute' method on top of the existing executeReport method.

Modified:
    
maven/jxr/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java

Modified: 
maven/jxr/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java
URL: 
http://svn.apache.org/viewvc/maven/jxr/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java?rev=1160829&r1=1160828&r2=1160829&view=diff
==============================================================================
--- 
maven/jxr/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java
 (original)
+++ 
maven/jxr/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java
 Tue Aug 23 18:12:48 2011
@@ -35,6 +35,7 @@ import org.apache.maven.jxr.JXR;
 import org.apache.maven.jxr.JxrException;
 import org.apache.maven.model.Organization;
 import org.apache.maven.model.ReportPlugin;
+import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.reporting.AbstractMavenReport;
 import org.apache.maven.reporting.MavenReportException;
@@ -435,6 +436,32 @@ public abstract class AbstractJxrReport
         return canGenerate;
     }
 
+    /* 
+     * This is called for a standalone execution. Well, that's the claim. It 
also ends up called for the aggregate mojo, since 
+     * that is configured as an execution, not in the reporting section, at 
least by some people on some days. We do NOT want
+     * the default behavior.
+     */
+    public void execute()
+        throws MojoExecutionException
+    {
+        
+        if ( skip )
+        {
+            getLog().info( "Skipping JXR." );
+            return;
+        }
+        
+        Locale locale = Locale.getDefault();
+        try
+        {
+            executeReport( locale );
+        }
+        catch ( MavenReportException e )
+        {
+            throw new MojoExecutionException( "Error generating JXR report", e 
);
+        }
+    }
+
     /**
      * @see 
org.apache.maven.reporting.AbstractMavenReport#executeReport(java.util.Locale)
      */


Reply via email to