webstart maven plugin - gwenn/hypomnemata GitHub Wiki

Patch

See http://jira.codehaus.org/browse/MWEBSTART-113

Index: pom.xml
===================================================================
--- pom.xml	(revision 17969)
+++ pom.xml	(working copy)
@@ -8,7 +8,7 @@
 
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>webstart-maven-plugin</artifactId>
-  <version>1.0-beta-3</version>
+  <version>1.0-beta-3-me</version>
   <packaging>maven-plugin</packaging>
   <name>MWEBSTART :: Webstart Maven Plugin</name>
   <description>Maven plugin that supports webstart application development. Helps generate JNLP files and supports the
@@ -41,7 +41,7 @@
     <dependency>
       <groupId>org.codehaus.mojo</groupId>
       <artifactId>webstart-pack200-api</artifactId>
-      <version>${project.version}</version>
+      <version>${parent.version}</version>
     </dependency>
 
     <dependency>
@@ -229,7 +229,7 @@
         <dependency>
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>webstart-pack200-impl</artifactId>
-          <version>${project.version}</version>
+          <version>${parent.version}</version>
           <scope>runtime</scope>
         </dependency>
         <dependency>
@@ -247,7 +247,7 @@
         <dependency>
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>webstart-pack200-impl</artifactId>
-          <version>${project.version}</version>
+          <version>${parent.version}</version>
           <scope>runtime</scope>
         </dependency>
         <dependency>
@@ -265,7 +265,7 @@
         <dependency>
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>webstart-pack200-impl</artifactId>
-          <version>${project.version}</version>
+          <version>${parent.version}</version>
           <scope>runtime</scope>
         </dependency>
         <dependency>
Index: src/main/java/org/codehaus/mojo/webstart/generator/JarResourcesGenerator.java
===================================================================
--- src/main/java/org/codehaus/mojo/webstart/generator/JarResourcesGenerator.java	(revision 17969)
+++ src/main/java/org/codehaus/mojo/webstart/generator/JarResourcesGenerator.java	(working copy)
@@ -99,7 +99,7 @@
 
                 if ( jarResource.isOutputJarVersion() )
                 {
-                    buffer.append( " version=\"" ).append( jarResource.getVersion() ).append( "\"" );
+                    buffer.append( " version=\"" ).append( jarResource.getJnlpVersion() ).append( "\"" );
                 }
 
                 if ( jarResource.getMainClass() != null )
Index: src/main/java/org/codehaus/mojo/webstart/generator/VersionXmlGenerator.java
===================================================================
--- src/main/java/org/codehaus/mojo/webstart/generator/VersionXmlGenerator.java	(revision 17969)
+++ src/main/java/org/codehaus/mojo/webstart/generator/VersionXmlGenerator.java	(working copy)
@@ -130,7 +130,7 @@
             writer.write( "</name>" );
             writer.newLine();
             writer.write( "      <version-id>" );
-            writer.write( jarResource.getVersion() );
+            writer.write( jarResource.getJnlpVersion() );
             writer.write( "</version-id>" );
             writer.newLine();
             writer.write( "    </pattern>" );
Index: src/main/java/org/codehaus/mojo/webstart/JarResource.java
===================================================================
--- src/main/java/org/codehaus/mojo/webstart/JarResource.java	(revision 17969)
+++ src/main/java/org/codehaus/mojo/webstart/JarResource.java	(working copy)
@@ -54,6 +54,7 @@
 
     private String type;
 
+	private String timestamp;
     /**
      * Creates a new uninitialized {@code JarResource}.
      */
@@ -203,11 +204,19 @@
      *
      * @return Returns the value of the version field.
      */
-    public String getVersion()
-    {
-        return this.version;
+    public String getVersion() {
+		return this.version;
     }
 
+	public String getJnlpVersion() {
+		if (version.indexOf("SNAPSHOT") >= 0) {
+			if (timestamp == null) {
+				timestamp = String.valueOf(System.currentTimeMillis());
+			}
+			return version.replaceFirst("SNAPSHOT", timestamp);
+		}
+		return this.version;
+	}
     /**
      * Returns the fully qualified class name of the JNLP application's 'main' class but
      * only if it is contained in the jar represented by this instance. Only one jarResource per
@@ -241,9 +250,8 @@
      *
      * @return Returns the value of the outputJarVersion field.
      */
-    public boolean isOutputJarVersion()
-    {
-        return this.outputJarVersion;
+    public boolean isOutputJarVersion() {
+		return this.outputJarVersion;
     }
 
     /**
⚠️ **GitHub.com Fallback** ⚠️