2 Replies Latest reply: Dec 19, 2012 2:25 PM by heismann RSS

    Ant task <fx:deploy> creates shortcut element incorrectly

    heismann
      I have a JavaFX application being deployed via webstart. I'm using the javafx ant tasks from maven to generate the JNLP file. I've specified that the desktop shortcut hint should be created in the JNLP file. This occurs successfully, but the shortcut is not created/user is not asked. The resulting JNLP file has a the shortcut element in it (<shortcut><desktop/></shortcut>), but it appears to be in the incorrect place. I'm using Java7 update 9 and the JavaFX SDK and Ant tasks that come with it.

      According to the JNLP documentation the desktop element is supposed to be a child of the <information> element: http://docs.oracle.com/javase/7/docs/technotes/guides/javaws/developersguide/syntax.html#information

      According to the JavaFX Ant task documentation the <fx:preferences shortcut="true" /> element is not a child of the <fx:info> element: http://docs.oracle.com/javafx/2/deployment/javafx_ant_task_reference002.htm#CIAIEJHG

      Is there some other way to get the <shortcut> element to be placed in the correct location while still using the Ant tasks?

      Thanks

      EDIT

      In the meantime, I'm moving the element to the appropriate location using some Groovy.

      String jnlpFileName = "$pom.build.directory/web-dist/clarity-client-javafx.jnlp"
      def jnlp = new XmlParser().parse( new File( jnlpFileName ) )
      def shortcut = jnlp.shortcut[0]
      if ( shortcut )
      {
      // move the shortcut element to the appropriate location
      jnlp.remove( shortcut )
      jnlp.information[0].append( shortcut )

      new File( jnlpFileName ).withWriter { out ->
      printer = new XmlNodePrinter( new PrintWriter( out ) )
      printer.preserveWhitespace = true
      printer.print( jnlp )
      }
      }

      Edited by: heismann on Dec 18, 2012 11:03 AM