How to prevent Maven Webstart from building a zip file?

1.5k views Asked by At

I'm using Maven for my build cycle, including using the maven-webstart-plugin to generate a jnlp file. This process signs the jars and creates a jnlp from a template (which is great), but then also creates a zip file of all the signed jars and the jnlp file (which might be helpful, but I don't want).

The docs for the maven-webstart-plugin aren't particularly comprehensive... http://mojo.codehaus.org/webstart/webstart-maven-plugin/jnlp-mojos-overview.html

In fact, I found stackoverflow the best source for useful information - e.g. Looking for Webstart Maven Plugin sample application

There seems to be a way to do this in the maven-webstart-plugin configuration - e.g. (from the examples above):

<plugins>
  <plugin>
    <groupId>org.codehaus.mojo.webstart</groupId>
    <artifactId>webstart-maven-plugin</artifactId>
    <configuration>
      ...
      <pack200>true</pack200>
      <gzip>true</gzip> <!-- default force when pack200 false, true when pack200 selected ?? -->
      ...
    </configuration>
  </plugin>
</plugins>

Does anyone know what the tag does?

I expected the < gzip > tag to allow one to exclude the creation of the zip file by setting it to < gzip > false < /gzip >, but my testing of this suggests that's not the case. In indeed that is not the case, does anyone know what the < gzip > tag does?

Finally, if those aren't the relevant tags, is it possible to prevent the creation of the zip file? If so, how?

1

There are 1 answers

2
Paul Austdal On

You can disable creation of the complete zip archive by adding <makeArchive>false</makeArchive> to the web start plugin configuration.

As you know, using <pack200>true</pack200> produces an extra pack200 compressed version of the libraries in your distribution.

When adding <gzip>true</gzip>, every packed library is being compressed with gzip.

You will get libraries like these depending of the configuration combination you use:

  • log4j-1.2.16.jar
  • log4j-1.2.16.jar.pack
  • log4j-1.2.16.jar.pack.gz

The gzip setting seems to require that pack200 is enabled as well. The unpacked/uncompressed versions are always included in the distribution.

I'm sure you are aware that your jnlp file will need to include the following in order to make use of the packed/gzipped libraries:

<resources>
  <property name="jnlp.packEnabled" value="true"/>
</resources>

Pack200/gzip results for one of my JWS applications:

  • Unpacked/un-gzipped jars: 13 167 855 bytes
  • Pack200'ed jars: 11 807 799 bytes
  • Packed and gzipped jars: 4 821 048 bytes

As you can see, the pack200/gzip combination will make a real difference for installation and upgrade times.