JavaFX packaging tools (was Re: JavaFX plugin for SBT)

Werner Lehmann lehmann at media-interactive.de
Tue Nov 13 03:08:01 PST 2012


Hi,

let me hijack this thread to share a little detail I learned about the 
<fx:jar> task the other day. For the manifest I needed to reference 
dependency jars from several different directories. Those jars are also 
used for compilation so I have an Ant resource collection for those already:

     <union id="myjars">
       <filelist dir="${core.lib}">
         <file name="activation-1.1.jar"/>
         ...
       </filelist>
       <filelist dir="${guicore.lib}">
         ...
       </filelist>
       ...
     </union>

Using Ant's pathconvert I can convert this into a string suitable for 
the manifest class-path attribute. Now, with <fx:jar> the documentation 
indicates that I should use <fx:resources> to list jars needed for the 
class-path (or, JavaFX-Class-Path is what it actually generates).

Unfortunately, <fx:resources> is not compatible with Ant's resources, 
and it cannot reference them, let alone offer the flexibility of 
pathconvert, e.g. to prefix each jar in the path. So my nice and 
existing and lengthy resource collection did not work and I'd have to 
repeat all that for <fx:resources>.

This is a problem for Maven as well, it seems:
> http://myjavafx.blogspot.de/2012/08/building-signing-and-deploying-your.html

This blog post showed that you can simply ignore <fx:resources> and 
continue to provide the class-path yourself. It wouldn't have occurred 
to me :)

So I can still do this:

     <fx:jar destfile="...">
       <fx:application name="..." mainClass="..."/>
       <fileset dir="..."/>
       <manifest>
         <attribute name="Built-By" value="..."/>
         <attribute name="JavaFX-Class-Path" value="my.dist-classpath}"/>
       </manifest>
     </fx:jar>

Whereas my.dist-classpath is provided by pathconvert (with a 
chainedmapper, flattenmapper, globmapper) and generated from myjars.

Might be useful for somebody.

Rgds
Werner



More information about the openjfx-dev mailing list