Maven and WebStart (jnlp)

If you plan to deploy your maven application via webstart you are a lucky man, because this is easy if you know how to do it😉

I tried it without success, but then Geoffrey with his networktools came to my rescue. Now TimeFinder is jnlp-enabled. The following steps were necessary:

  1. create a new folder ‘jnlp’ under src/ (where main and test live)
  2. put the file template.vm there with:
    <?xml version="1.0" encoding="utf-8"?>
    <jnlp spec="1.0+" codebase="http://timefinder.sourceforge.net/jnlp2" href="$outputFile">
     <information>
        <title>TimeFinder</title>
        <vendor>TimeFinder Team</vendor>
        <homepage href="http://timefinder.sourceforge.net/"/>
        <description kind="one-line">TimeFinder</description>
        <description kind="short">TimeFinder - the automatic timetabling generator for universities and schools</description>
        <description kind="tooltip">TimeFinder - the automatic timetabling generator for universities and schools</description>
        <icon href="http://timefinder.sourceforge.net/jnlp/shamrockwhite.jpg" kind="default"/>
        <shortcut online="false"><desktop/><menu submenu="TimeFiner"/></shortcut>
     </information>
     <security>
     <all-permissions/>
     </security>
     <resources>
        <j2se version="1.6+" initial-heap-size="32m" max-heap-size="128m" />
        <property name="jnlp.versionEnabled" value="true"/>
        $dependencies
     </resources>
     <application-desc main-class="$mainClass">
     </application-desc>
    </jnlp>
  3. create a keystore:
    keytool -genkey -alias timefinder -keystore timefinder.jks
    be sure that you use keytool from the same JDK-PATH as you use for maven!
  4. add the following to your pom.xml:
    <build>
      <plugins>
        <plugin>
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>webstart-maven-plugin</artifactId>
           <version>1.0-alpha-1</version>
       </plugin>
     </plugins>
     <pluginManagement>
        <plugins>
           <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>webstart-maven-plugin</artifactId>
             <!-- do not bind to install phase
              <executions>
               <execution>
                 <goals>
                   <goal>report</goal>
                 </goals>
               </execution>
              </executions>
              -->
            <configuration>
               <jnlp>
                <mainClass>de.timefinder.core.Startup</mainClass>
               </jnlp>
              <sign>
               <keystore>/home/peterk/Dokumente/quell/timefinder/trunk/timefinder-core/timefinder.jks</keystore>
               <keypass>unsecpwd</keypass>
               <storepass>unsecpwd</storepass>
               <storetype>jks</storetype>
               <alias>timefinder</alias>
               <verify>true</verify>
             </sign>
            <verbose>true</verbose>
          </configuration>
         </plugin>
       </plugins>
      </pluginManagement>
     </build>
    </project>
  5. Now you should be able to execute:
    mvn install webstart:jnlp
    which will create a zip file with all the signed jars
  6. See my next post for versioning and pack200!

9 thoughts on “Maven and WebStart (jnlp)

  1. mvn install webstart:jnlp — gave me a horrible error, simply running it again made it work!

  2. Pingback: Further with Maven and WebStart (jnlp) « Java and more …

  3. Is there some reason you used the older 1.0-alpha-1 version rather than the newer 1.0-alpha-2 version of the plugin?

  4. And from which repository I can get this version? I cannot find it … although the website indicates that 1.0-alpha-2 should be available since 2007 !?

Comments are closed.