svn commit: r422229 - in /maven/sandbox/plugins/maven-changes-plugin/src/main: java/org/apache/maven/changes/ resources/org/apache/maven/plugin/ resources/org/apache/maven/plugin/changes/ resources/org/apache/maven/plugin/changes/images/

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r422229 - in /maven/sandbox/plugins/maven-changes-plugin/src/main: java/org/apache/maven/changes/ resources/org/apache/maven/plugin/ resources/org/apache/maven/plugin/changes/ resources/org/apache/maven/plugin/changes/images/

Dennis Lundberg-2
Author: dennisl
Date: Sat Jul 15 07:18:23 2006
New Revision: 422229

URL: http://svn.apache.org/viewvc?rev=422229&view=rev
Log:
[MCHANGES-38] All images in the report are broken.

Added:
    maven/sandbox/plugins/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/
    maven/sandbox/plugins/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/changes/
    maven/sandbox/plugins/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/changes/images/
    maven/sandbox/plugins/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/changes/images/add.gif   (with props)
    maven/sandbox/plugins/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/changes/images/fix.gif   (with props)
    maven/sandbox/plugins/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/changes/images/remove.gif   (with props)
    maven/sandbox/plugins/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/changes/images/rss.png   (with props)
    maven/sandbox/plugins/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/changes/images/update.gif   (with props)
Modified:
    maven/sandbox/plugins/maven-changes-plugin/src/main/java/org/apache/maven/changes/ChangesMojo.java

Modified: maven/sandbox/plugins/maven-changes-plugin/src/main/java/org/apache/maven/changes/ChangesMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-changes-plugin/src/main/java/org/apache/maven/changes/ChangesMojo.java?rev=422229&r1=422228&r2=422229&view=diff
==============================================================================
--- maven/sandbox/plugins/maven-changes-plugin/src/main/java/org/apache/maven/changes/ChangesMojo.java (original)
+++ maven/sandbox/plugins/maven-changes-plugin/src/main/java/org/apache/maven/changes/ChangesMojo.java Sat Jul 15 07:18:23 2006
@@ -17,6 +17,8 @@
  */
 
 import java.io.File;
+import java.io.IOException;
+import java.net.URL;
 import java.util.Locale;
 import java.util.ResourceBundle;
 
@@ -24,6 +26,7 @@
 import org.apache.maven.reporting.AbstractMavenReport;
 import org.apache.maven.reporting.MavenReportException;
 import org.codehaus.doxia.site.renderer.SiteRenderer;
+import org.codehaus.plexus.util.FileUtils;
 
 /**
  * Goal which creates a nicely formatted Changes Report in html format from a changes.xml file.
@@ -83,25 +86,50 @@
      */
     private String url;
 
- public boolean canGenerateReport()
- {
+    public boolean canGenerateReport()
+    {
         File xmlFile = new File( xmlPath );
         return xmlFile.exists();
- }
+    }
+
+    private void copyStaticResources()
+        throws MavenReportException
+    {
+        final String PLUGIN_RESOURCES_BASE = "org/apache/maven/plugin/changes";
+        String resourceNames[] =
+            {"images/add.gif", "images/fix.gif", "images/remove.gif", "images/rss.png", "images/update.gif"};
+        try
+        {
+            getLog().debug( "Copying static resources." );
+            for ( int i = 0; i < resourceNames.length; i++ )
+            {
+                URL url =
+                    this.getClass().getClassLoader().getResource( PLUGIN_RESOURCES_BASE + "/" + resourceNames[i] );
+                FileUtils.copyURLToFile( url, new File( outputDirectory, resourceNames[i] ) );
+            }
+        }
+        catch ( IOException e )
+        {
+            throw new MavenReportException( "Unable to copy static resources." );
+        }
+    }
 
     public void executeReport( Locale locale )
         throws MavenReportException
     {
- ChangesReportGenerator report = new ChangesReportGenerator( xmlPath );
+        ChangesReportGenerator report = new ChangesReportGenerator( xmlPath );
+
+        if ( ( url == null ) || ( url.trim().equals( "" ) ) )
+        {
+            getLog().warn( getBundle( locale ).getString( "report.changes.warn.url" ) );
+        }
+
+        report.setIssueLink( link_template );
+        report.setUrl( url );
+        report.doGenerateReport( getBundle( locale ), getSink() );
 
- if ( ( url == null ) || ( url.trim().equals( "" ) ) )
- {
- getLog().warn( getBundle( locale ).getString( "report.changes.warn.url" ) );
- }
-
- report.setIssueLink( link_template );
- report.setUrl( url );
- report.doGenerateReport( getBundle( locale ), getSink() );
+        // Copy the images
+        copyStaticResources();
     }
 
     public String getName( Locale locale )

Added: maven/sandbox/plugins/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/changes/images/add.gif
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/changes/images/add.gif?rev=422229&view=auto
==============================================================================
Binary file - no diff available.

Propchange: maven/sandbox/plugins/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/changes/images/add.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: maven/sandbox/plugins/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/changes/images/fix.gif
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/changes/images/fix.gif?rev=422229&view=auto
==============================================================================
Binary file - no diff available.

Propchange: maven/sandbox/plugins/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/changes/images/fix.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: maven/sandbox/plugins/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/changes/images/remove.gif
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/changes/images/remove.gif?rev=422229&view=auto
==============================================================================
Binary file - no diff available.

Propchange: maven/sandbox/plugins/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/changes/images/remove.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: maven/sandbox/plugins/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/changes/images/rss.png
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/changes/images/rss.png?rev=422229&view=auto
==============================================================================
Binary file - no diff available.

Propchange: maven/sandbox/plugins/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/changes/images/rss.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: maven/sandbox/plugins/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/changes/images/update.gif
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/changes/images/update.gif?rev=422229&view=auto
==============================================================================
Binary file - no diff available.

Propchange: maven/sandbox/plugins/maven-changes-plugin/src/main/resources/org/apache/maven/plugin/changes/images/update.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream