maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vsive...@apache.org
Subject svn commit: r832410 - in /maven/shared/branches/maven-reporting-impl-2.0.4.x: pom.xml src/main/java/org/apache/maven/reporting/AbstractMavenReport.java
Date Tue, 03 Nov 2009 13:30:02 GMT
Author: vsiveton
Date: Tue Nov  3 13:30:02 2009
New Revision: 832410

URL: http://svn.apache.org/viewvc?rev=832410&view=rev
Log:
MSHARED-120: No single report generated with latest maven-reporting-impl

o changed the impl to be able to run single report

Modified:
    maven/shared/branches/maven-reporting-impl-2.0.4.x/pom.xml
    maven/shared/branches/maven-reporting-impl-2.0.4.x/src/main/java/org/apache/maven/reporting/AbstractMavenReport.java

Modified: maven/shared/branches/maven-reporting-impl-2.0.4.x/pom.xml
URL: http://svn.apache.org/viewvc/maven/shared/branches/maven-reporting-impl-2.0.4.x/pom.xml?rev=832410&r1=832409&r2=832410&view=diff
==============================================================================
--- maven/shared/branches/maven-reporting-impl-2.0.4.x/pom.xml (original)
+++ maven/shared/branches/maven-reporting-impl-2.0.4.x/pom.xml Tue Nov  3 13:30:02 2009
@@ -62,16 +62,14 @@
   </properties>
 
   <dependencies>
+    <!-- maven -->
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-project</artifactId>
       <version>${mavenVersion}</version>
     </dependency>
-    <dependency>
-      <groupId>commons-validator</groupId>
-      <artifactId>commons-validator</artifactId>
-      <version>1.2.0</version>
-    </dependency>
+
+    <!-- doxia -->
     <dependency>
       <groupId>org.apache.maven.doxia</groupId>
       <artifactId>doxia-core</artifactId>
@@ -92,6 +90,25 @@
       <artifactId>doxia-site-renderer</artifactId>
       <version>${doxiaVersion}</version>
     </dependency>
+
+    <!-- misc -->
+    <dependency>
+      <groupId>commons-validator</groupId>
+      <artifactId>commons-validator</artifactId>
+      <version>1.2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.shared</groupId>
+      <artifactId>maven-doxia-tools</artifactId>
+      <version>1.0.2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <version>1.5.8</version>
+    </dependency>
+
+    <!-- test -->
     <dependency>
       <groupId>junit-addons</groupId>
       <artifactId>junit-addons</artifactId>

Modified: maven/shared/branches/maven-reporting-impl-2.0.4.x/src/main/java/org/apache/maven/reporting/AbstractMavenReport.java
URL: http://svn.apache.org/viewvc/maven/shared/branches/maven-reporting-impl-2.0.4.x/src/main/java/org/apache/maven/reporting/AbstractMavenReport.java?rev=832410&r1=832409&r2=832410&view=diff
==============================================================================
--- maven/shared/branches/maven-reporting-impl-2.0.4.x/src/main/java/org/apache/maven/reporting/AbstractMavenReport.java
(original)
+++ maven/shared/branches/maven-reporting-impl-2.0.4.x/src/main/java/org/apache/maven/reporting/AbstractMavenReport.java
Tue Nov  3 13:30:02 2009
@@ -20,14 +20,21 @@
  */
 
 import org.apache.maven.doxia.sink.Sink;
+import org.apache.maven.doxia.site.decoration.DecorationModel;
 import org.apache.maven.doxia.siterenderer.Renderer;
+import org.apache.maven.doxia.siterenderer.RendererException;
+import org.apache.maven.doxia.siterenderer.SiteRenderingContext;
 import org.apache.maven.doxia.siterenderer.sink.SiteRendererSink;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.reporting.sink.SinkFactory;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.WriterFactory;
 
 import java.io.File;
+import java.io.IOException;
+import java.io.Writer;
 import java.util.Locale;
 
 /**
@@ -58,11 +65,12 @@
     public void execute()
         throws MojoExecutionException
     {
+        SiteRendererSink sink;
         try
         {
             String outputDirectory = getOutputDirectory();
 
-            SiteRendererSink sink =
+            sink =
                 SinkFactory.createSink( new File( outputDirectory ), getOutputName() + ".html"
);
 
             generate( sink, Locale.getDefault() );
@@ -75,6 +83,36 @@
             throw new MojoExecutionException( "An error has occurred in " + getName( locale
) + " report generation.",
                                               e );
         }
+
+        File outputHtml = new File( getOutputDirectory(), getOutputName() + ".html" );
+        outputHtml.getParentFile().mkdirs();
+
+        Writer writer = null;
+        try
+        {
+            SiteRenderingContext context = new SiteRenderingContext();
+            context.setDecoration( new DecorationModel() );
+            context.setTemplateName( "org/apache/maven/doxia/siterenderer/resources/default-site.vm"
);
+            context.setLocale( locale );
+
+            writer = WriterFactory.newXmlWriter( outputHtml );
+
+            getSiteRenderer().generateDocument( writer, sink, context );
+        }
+        catch ( RendererException e )
+        {
+            throw new MojoExecutionException( "An error has occurred in " + getName( Locale.ENGLISH
)
+                + " report generation.", e );
+        }
+        catch ( IOException e )
+        {
+            throw new MojoExecutionException( "An error has occurred in " + getName( Locale.ENGLISH
)
+                + " report generation.", e );
+        }
+        finally
+        {
+            IOUtil.close( writer );
+        }
     }
 
     /**
@@ -100,6 +138,7 @@
 
     protected void closeReport()
     {
+        getSink().close();
     }
 
     public String getCategoryName()



Mime
View raw message