All pastes #49256 Raw Edit

Someone

public text v1 · immutable
#49256 ·published 2006-04-13 13:57 UTC
rendered paste body
Index: pom.xml
===================================================================
--- pom.xml     (revision 1817)
+++ pom.xml     (working copy)
@@ -47,38 +47,143 @@
       <name>David Boden</name>
       <email>dave@daveboden.com</email>
     </contributor>
+    <contributor>
+      <!--<id>ge0ffrey</id>-->
+      <name>Geoffrey De Smet</name>
+      <email>ge0ffrey.spam_AT_gmail.com</email>
+      <roles>
+          <role>Java developer</role>
+      </roles>
+      <timezone>+1</timezone>
+    </contributor>
   </contributors>

   <modules>
+    <module>plugin</module><!-- TODO "plugin" says nothing, refactor to "jnlp"? -->
+    <module>jnlp-report</module>
     <module>pack200-anttasks</module>
+    <module>pack200-jdk14</module>
     <module>jnlp-servlet</module>
-    <module>plugin</module>
-    <module>pack200-jdk14</module>
   </modules>

+  <dependencyManagement>
+      <dependencies>
+        <dependency>
+          <groupId>org.apache.maven</groupId>
+          <artifactId>maven-project</artifactId>
+          <version>2.0.1</version>
+        </dependency>
+        <dependency>
+          <groupId>org.apache.maven</groupId>
+          <artifactId>maven-core</artifactId>
+          <version>2.0.1</version>
+        </dependency>
+        <dependency>
+          <groupId>org.apache.maven</groupId>
+          <artifactId>maven-plugin-descriptor</artifactId>
+          <version>2.0.1</version>
+        </dependency>
+        <dependency>
+          <groupId>org.apache.maven</groupId>
+          <artifactId>maven-settings</artifactId>
+          <version>2.0.1</version>
+        </dependency>
+        <dependency>
+          <groupId>junit</groupId>
+          <artifactId>junit</artifactId>
+          <version>3.8.1</version>
+          <scope>test</scope>
+        </dependency>
+        <dependency>
+          <groupId>org.codehaus.plexus</groupId>
+          <artifactId>plexus-utils</artifactId>
+          <version>1.0.4</version>
+        </dependency>
+        <dependency>
+          <groupId>commons-lang</groupId>
+          <artifactId>commons-lang</artifactId>
+          <version>2.1</version>
+        </dependency>
+        <!--dependency>
+          <groupId>org.codehaus.plexus</groupId>
+          <artifactId>plexus-archiver</artifactId>
+          <version>1.0-alpha-3</version>
+        </dependency-->
+        <dependency>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-jar-plugin</artifactId>
+          <version>2.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+          <groupId>org.codehaus.mojo</groupId>
+          <artifactId>keytool-maven-plugin</artifactId>
+          <version>[0.3,)</version>
+        </dependency>
+        <dependency>
+          <groupId>velocity</groupId>
+          <artifactId>velocity</artifactId>
+          <version>1.4</version>
+        </dependency>
+        <dependency>
+          <groupId>commons-lang</groupId>
+          <artifactId>commons-lang</artifactId>
+          <version>2.1</version>
+        </dependency>
+
+        <!-- Reporting -->
+        <dependency>
+          <groupId>org.apache.maven.reporting</groupId>
+          <artifactId>maven-reporting-api</artifactId>
+          <version>2.0</version>
+        </dependency>
+        <dependency>
+          <groupId>org.apache.maven.reporting</groupId>
+          <artifactId>maven-reporting-impl</artifactId>
+          <version>2.0</version>
+        </dependency>
+      </dependencies>
+  </dependencyManagement>
+
   <profiles>
     <profile>
+      <id>jdk16</id>
+      <activation>
+        <jdk>1.6</jdk>
+      </activation>
+      <dependencies>
+        <dependency>
+          <groupId>org.codehaus.mojo</groupId>
+          <artifactId>pack200-jdk15</artifactId>
+          <version>${version}</version>
+        </dependency>
+      </dependencies>
+    </profile>
+    <profile>
       <id>jdk15</id>
       <activation>
         <jdk>1.5</jdk>
       </activation>
-
-      <modules>
-        <module>pack200-jdk15</module>
-      </modules>
+      <dependencies>
+        <dependency>
+          <groupId>org.codehaus.mojo</groupId>
+          <artifactId>pack200-jdk15</artifactId>
+          <version>${version}</version>
+        </dependency>
+      </dependencies>
     </profile>
-
     <profile>
-      <id>jdk16</id>
+      <id>jdk14</id>
       <activation>
-        <jdk>1.6</jdk>
+        <jdk>1.4</jdk>
       </activation>
-
-      <modules>
-        <module>pack200-jdk15</module>
-      </modules>
+      <dependencies>
+        <dependency>
+          <groupId>org.codehaus.mojo</groupId>
+          <artifactId>pack200-jdk14</artifactId>
+          <version>${version}</version>
+        </dependency>
+      </dependencies>
     </profile>
-
   </profiles>

   <reporting>
Index: jnlp-report/src/main/java/org/codehaus/mojo/webstart/JnlpReportMojo.java
===================================================================
--- jnlp-report/src/main/java/org/codehaus/mojo/webstart/JnlpReportMojo.java    (revision 0)
+++ jnlp-report/src/main/java/org/codehaus/mojo/webstart/JnlpReportMojo.java    (revision 0)
@@ -0,0 +1,183 @@
+package org.codehaus.mojo.webstart;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.List;
+import java.util.Iterator;
+
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.reporting.AbstractMavenReport;
+import org.apache.maven.reporting.MavenReportException;
+import org.apache.maven.plugin.MojoExecutionException;
+
+import org.codehaus.doxia.site.renderer.SiteRenderer;
+import org.codehaus.plexus.util.FileUtils;
+
+/**
+ * @description  Creates a Jnlp Report
+ * @goal         report
+ * @author Geoffrey De Smet
+ */
+public class JnlpReportMojo
+    extends AbstractMavenReport
+{
+    /**
+     * Location where generated html will be created.
+     *
+     * @parameter expression="${project.build.directory}/site"
+     *
+     */
+    private File outputDirectory;
+
+    /**
+     * Doxia Site Renderer
+     *
+     * @parameter expression="${component.org.codehaus.doxia.site.renderer.SiteRenderer}"
+     * @required @readonly
+     */
+    private SiteRenderer siteRenderer;
+
+    /**
+     * Maven Project
+     *
+     * @parameter expression="${project}"
+     * @required @readonly
+     */
+    private MavenProject project;
+
+    /**
+     * Directory where the jnlp artifacts and jnlp sources files reside.
+     *
+     * @parameter expression="${project.build.directory}/jnlp"
+     * @required
+     */
+    private File jnlpSourceDirectory;
+
+    /**
+     * Directory in the site directory where the jnlp artifacts and jnlp sources files reside.
+     *
+     * @parameter expression="jnlp/launch.jnlp"
+     * @required
+     */
+    private String siteJnlpFile;
+
+    /**
+     * The default filename to use for the report.
+     *
+     * @parameter expression="${outputName}" default-value="jnlp-report"
+     * @required
+     */
+    private String outputName;
+
+    public void executeReport( Locale locale )
+                       throws MavenReportException
+    {
+        copyJnlpFiles();
+        fillReport( locale );
+    }
+
+    private void copyJnlpFiles() throws MavenReportException
+    {
+        if ( ! jnlpSourceDirectory.exists() )
+        {
+            throw new MavenReportException("jnlpSourceDirectory does not exist");
+        }
+        try
+        {
+            File destinationDirectory = new File(outputDirectory, siteJnlpFile).getParentFile();
+            List files = FileUtils.getFiles( jnlpSourceDirectory, "**/*", "" );
+            for ( Iterator i = files.iterator(); i.hasNext(); )
+            {
+                File file = (File) i.next();
+                getLog().debug( "Copying " + file + " to " + destinationDirectory );
+                String path = file.getAbsolutePath().substring( jnlpSourceDirectory.getAbsolutePath().length() + 1 );
+                File destDir = new File( destinationDirectory, path );
+                getLog().debug( "Copying " + file + " to " + destDir );
+                if ( file.isDirectory() ) {
+                    destDir.mkdirs();
+                } else {
+                    FileUtils.copyFileToDirectory( file, destDir.getParentFile() );
+                }
+            }
+        }
+        catch ( IOException e )
+        {
+            throw new MavenReportException("Failed to copy jnlp files", e);
+        }
+    }
+
+    private void fillReport( Locale locale )
+    {
+        getSink().head();
+        getSink().text( getBundle(locale).getString( "report.jnlp-report.description" ) );
+        getSink().head_();
+        getSink().body();
+        getSink().sectionTitle1();
+        getSink().text(getBundle(locale).getString("report.jnlp-report.label.installation.header"));
+        getSink().sectionTitle1_();
+        getSink().paragraph();
+        getSink().text(getBundle(locale).getString("report.jnlp-report.label.installation.description"));
+        getSink().paragraph_();
+        getSink().paragraph();
+        getSink().link(siteJnlpFile);
+        getSink().text(getBundle(locale).getString("report.jnlp-report.label.installation.webStartMeNow"));
+        getSink().link_();
+        getSink().paragraph_();
+        getSink().paragraph();
+        getSink().text(getBundle(locale).getString("report.jnlp-report.label.installation.getJava") + " ");
+        getSink().link("http://java.com");
+        getSink().text("http://java.com");
+        getSink().link_();
+        getSink().paragraph_();
+        getSink().sectionTitle1();
+        getSink().text(getBundle(locale).getString("report.jnlp-report.label.uninstallation.header"));
+        getSink().sectionTitle1_();
+        getSink().paragraph();
+        getSink().text(getBundle(locale).getString("report.jnlp-report.label.uninstallation.description"));
+        getSink().paragraph_();
+        getSink().body_();
+        getSink().flush();
+        getSink().close();
+    }
+
+    public String getName( Locale locale )
+    {
+        return getBundle( locale ).getString( "report.jnlp-report.name" );
+    }
+
+    public String getDescription( Locale locale )
+    {
+        return getBundle( locale ).getString( "report.jnlp-report.description" );
+    }
+
+    protected SiteRenderer getSiteRenderer(  )
+    {
+        return siteRenderer;
+    }
+
+    protected MavenProject getProject(  )
+    {
+        return project;
+    }
+
+    public String getOutputName(  )
+    {
+        return outputName;
+    }
+
+    protected String getOutputDirectory(  )
+    {
+        return outputDirectory.getPath();
+    }
+
+    private ResourceBundle getBundle( Locale locale )
+    {
+        return ResourceBundle.getBundle( "jnlp-report",
+                                         locale,
+                                         this.getClass(  ).getClassLoader(  ) );
+    }
+
+}
Index: jnlp-report/src/main/resources/jnlp-report.properties
===================================================================
--- jnlp-report/src/main/resources/jnlp-report.properties       (revision 0)
+++ jnlp-report/src/main/resources/jnlp-report.properties       (revision 0)
@@ -0,0 +1,9 @@
+report.jnlp-report.name=Maven JNLP Report
+report.jnlp-report.description=Report on the generated webstart application.
+report.jnlp-report.label.installation.header=Installing
+report.jnlp-report.label.installation.webStartMeNow=Webstart the application now
+report.jnlp-report.label.installation.description=Open the link below to install the application on your computer.
+report.jnlp-report.label.installation.getJava=You require Java to run this application.\
+  If you do not have Java, you can get it easily at
+report.jnlp-report.label.uninstallation.header=Uninstalling
+report.jnlp-report.label.uninstallation.description=The application can be easily uninstalled from the sofware control
panel.
Index: jnlp-report/pom.xml
===================================================================
--- jnlp-report/pom.xml (revision 0)
+++ jnlp-report/pom.xml (revision 0)
@@ -0,0 +1,26 @@
+<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>
+  <parent>
+    <groupId>org.codehaus.mojo</groupId>
+    <artifactId>webstart-maven-plugin-parent</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>jnlp-report-maven-plugin</artifactId>
+  <packaging>maven-plugin</packaging>
+  <version>1.0-SNAPSHOT</version>
+  <name>Maven JNLP Report Plugin</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.reporting</groupId>
+      <artifactId>maven-reporting-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.reporting</groupId>
+      <artifactId>maven-reporting-impl</artifactId>
+    </dependency>
+  </dependencies>
+</project>
Index: plugin/src/main/java/org/codehaus/mojo/webstart/JnlpMojo.java
===================================================================
--- plugin/src/main/java/org/codehaus/mojo/webstart/JnlpMojo.java       (revision 1817)
+++ plugin/src/main/java/org/codehaus/mojo/webstart/JnlpMojo.java       (working copy)
@@ -58,8 +58,8 @@
  * @author <a href="jerome@coffeebreaks.org">Jerome Lacoste</a>
  * @version $Id$
  * @goal jnlp
- * @phase package
  * @requiresDependencyResolution runtime
+ * @execute phase="package"
  * @requiresProject
  * @inheritedByDefault true
  * @todo refactor the common code with javadoc plugin
@@ -270,12 +270,12 @@
             fileFilters.add( filter1 );
             fileFilters.add( filter2 );
         }
-
+
         public boolean accept( File pathname )
         {
             for ( int i = 0; i < fileFilters.size(); i++ ) {
-                if ( ! ((FileFilter) fileFilters.get(i)).accept( pathname ) )
-                    return false;
+                if ( ! ((FileFilter) fileFilters.get(i)).accept( pathname ) )
+                    return false;
             }
             return true;
         }
@@ -346,7 +346,7 @@
         // interesting: copied files lastModified time stamp will be rounded.
         // We have to be sure that the startTime is before that time...
         // rounding to the second - 1 millis should be sufficient..
-        startTime = System.currentTimeMillis() - 1000;
+        startTime = System.currentTimeMillis() - 1000;

         File workDirectory = getWorkDirectory();
         getLog().debug( "using work directory " + workDirectory );
@@ -383,7 +383,7 @@
             /*
             for( Iterator it = getNativeLibs().iterator(); it.hasNext(); ) {
                 Artifact artifact = ;
-                Artifact copiedArtifact =
+                Artifact copiedArtifact =

                 // similar to what we do for jars, except that we must pack them into jar instead of copying.
                 // them
@@ -398,12 +398,12 @@
                         jarTask.execute();

                         nativeLibJar.setLastModified( nativeLib.lastModified() );
-
+
                         copiedArtifact = new ....
                     } else {
                         getLog().debug( "Copying native lib " + artifact );
                         copyFileToDirectory( artifact.getFile(), applicationFolder );
-
+
                         copiedArtifact = artifact;
                     }
                     copiedNativeArtifacts.add( copiedArtifact );
@@ -420,7 +420,7 @@
                 logCollection( "Some dependencies may be skipped. Here's the list of the artifacts that should be signe
d/packed: ",
                                 modifiedJnlpArtifacts );
             }
-
+
             if ( sign != null )
             {

@@ -445,8 +445,8 @@

                 int signedJars = signJars( workDirectory, updatedJarFileFilter );
                 if ( signedJars != modifiedJnlpArtifacts.size() ) {
-                    throw new IllegalStateException(
-                           "the number of signed artifacts differ from the number of modified artifacts. Implementation
 error"
+                    throw new IllegalStateException(
+                           "the number of signed artifacts differ from the number of modified artifacts. Implementation
 error"
                        );
                 }
             }
@@ -821,7 +821,7 @@

         File targetFile = new File( targetDirectory, sourceFile.getName() );

-        boolean shouldCopy = ! targetFile.exists()
+        boolean shouldCopy = ! targetFile.exists()
              || targetFile.lastModified() < sourceFile.lastModified();

         if ( shouldCopy ) {
@@ -863,8 +863,13 @@
         for ( int i = 0; i < jarFiles.length; i++ )
         {
             signJar.setJarPath( jarFiles[i] );
+<<<<<<< .mine
+            // we don't change the jar name
+            // signJar.setSignedJar(jarFiles[i]);
+=======
             // for some reason, it appears that the signed jar field is not null ?
             signJar.setSignedJar( null );
+>>>>>>> .r1817
             long lastModified = jarFiles[i].lastModified();
             signJar.execute();
             jarFiles[i].setLastModified( lastModified );
Index: plugin/pom.xml
===================================================================
--- plugin/pom.xml      (revision 1817)
+++ plugin/pom.xml      (working copy)
@@ -8,13 +8,15 @@
     <version>1.0-SNAPSHOT</version>
   </parent>

-  <artifactId>webstart-maven-plugin</artifactId>
+  <artifactId>webstart-maven-plugin</artifactId><!-- TODO See parent pom, refactor to jnlp-maven-plugin? -->
   <packaging>maven-plugin</packaging>
   <version>1.0-SNAPSHOT</version>
   <name>Maven Webstart Plugin</name>
   <inceptionYear>2005</inceptionYear>
   <url>http://mojo.codehaus.org/webstart-maven-plugin</url>

+<<<<<<< .mine
+=======
   <!-- work-around a maven issue MOJO-361 -->
   <scm>
     <url>https://svn.codehaus.org/mojo/trunk/mojo/mojo-sandbox/webstart-maven-plugin/plugin</url>
@@ -34,51 +36,37 @@
       </roles>
     </developer>
   </developers>
+>>>>>>> .r1817

-  <contributors>
-    <contributor>
-      <name>David Boden</name>
-      <email>dave@daveboden.com</email>
-    </contributor>
-  </contributors>
-
-
   <dependencies>
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-project</artifactId>
-      <version>2.0.1</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-core</artifactId>
-      <version>2.0.1</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-plugin-descriptor</artifactId>
-      <version>2.0.1</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-settings</artifactId>
-      <version>2.0.1</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
-      <version>3.8.1</version>
       <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-utils</artifactId>
-      <version>1.0.4</version>
     </dependency>
     <dependency>
       <groupId>commons-lang</groupId>
       <artifactId>commons-lang</artifactId>
-      <version>2.1</version>
     </dependency>
     <!--dependency>
       <groupId>org.codehaus.plexus</groupId>
@@ -88,66 +76,21 @@
     <dependency>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-jar-plugin</artifactId>
-      <version>2.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.codehaus.mojo</groupId>
       <artifactId>keytool-maven-plugin</artifactId>
-      <version>[0.3,)</version>
     </dependency>
     <dependency>
       <groupId>velocity</groupId>
       <artifactId>velocity</artifactId>
-      <version>1.4</version>
     </dependency>
     <dependency>
       <groupId>commons-lang</groupId>
       <artifactId>commons-lang</artifactId>
-      <version>2.1</version>
     </dependency>
   </dependencies>

-  <profiles>
-    <profile>
-      <id>jdk16</id>
-      <activation>
-        <jdk>1.6</jdk>
-      </activation>
-      <dependencies>
-        <dependency>
-          <groupId>org.codehaus.mojo</groupId>
-          <artifactId>pack200-jdk15</artifactId>
-          <version>${version}</version>
-        </dependency>
-      </dependencies>
-    </profile>
-    <profile>
-      <id>jdk15</id>
-      <activation>
-        <jdk>1.5</jdk>
-      </activation>
-      <dependencies>
-        <dependency>
-          <groupId>org.codehaus.mojo</groupId>
-          <artifactId>pack200-jdk15</artifactId>
-          <version>${version}</version>
-        </dependency>
-      </dependencies>
-    </profile>
-    <profile>
-      <id>jdk14</id>
-      <activation>
-        <jdk>1.4</jdk>
-      </activation>
-      <dependencies>
-        <dependency>
-          <groupId>org.codehaus.mojo</groupId>
-          <artifactId>pack200-jdk14</artifactId>
-          <version>${version}</version>
-        </dependency>
-      </dependencies>
-    </profile>
-  </profiles>

     <reporting>
       <plugins>