I just made a question about using javafxpackager to make JavaFX jars, you can see it here. My problem was that I couldn't include the classpath in the manifest. Well, while I was waiting for the answer, I tried maven-antrun-plugin
instead. It worked nice, and I could run my application with dependencies, BUT (there is always a but) only with the dependencies OUTSIDE my final jar. So it is like that:
FinalJar.jar
lib
|_{all dependencies here}
My manifest file is pointing to the dependencies via the JavaFX-Class-Path
property. If I put the dependencies inside the jar, like I want, it doesn't find my dependencies. Any help?
EDIT: Here's the step to add the dependencies to the jar, its inside the pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>package</phase>
<configuration>
<target>
<taskdef name="jfxjar" classname="com.sun.javafx.tools.ant.FXJar"
classpathref="maven.plugin.classpath" />
<jfxjar
destfile="${project.build.directory}/dist/${project.build.finalName}">
<fileset dir="${project.build.directory}/classes" />
<!-- Adds the dependencies to jar -->
<fileset dir="${project.build.directory}/lib/" includes="*.jar" />
<application name="${project.name}" mainClass="com.google.code.mzplay.principal.PrincipalFX" />
<resources>
<!-- Adds the dependencies to classpath -->
<fileset dir="${project.build.directory}/lib/" includes="*.jar" />
</resources>
</jfxjar>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ant-javafx</artifactId>
<version>${javafx.version}</version>
<systemPath>${java.home}/../lib/ant-javafx.jar</systemPath>
<scope>system</scope>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>javafx</artifactId>
<version>${javafx.version}</version>
<systemPath>${java.home}/lib/jfxrt.jar</systemPath>
<scope>system</scope>
</dependency>
</dependencies>
</plugin>