Javafx Jar bundled with dependencies

I just asked a question about using javafxpackager to create a JavaFX jar, you can see it here. My problem is that I cannot include the classpath in the manifest. Well, when I While waiting for the answer, I tried maven-antrun-plugin. It works well, I can run my application with dependencies, but (there is always one but) only the dependency OUTSIDE my last jar. So it is like this Of:

FinalJar.jar
lib
|_{all dependencies here}

My manifest file passed The JavaFX-Class-Path attribute points to the dependency. If I put the dependency in the jar, like I want, it cannot find my dependency. Does it help?

Edit: This is the step of adding dependencies to the jar, which is located in pom.xml:


< groupId>org.apache.maven.plugins
maven-antrun-plugin
1.6


package


classpathref="maven.plugin.classpath" />
destfile="${project.build.directory}/dist/${project. build.finalName}">





< br />







run< /goal>





com. oracle
ant-javafx
${javafx.version}
${java.home}/../lib/ant-javafx.jar
system


com.oracle
javafx
${javafx.version}
${java.home}/lib/jfxrt.jar
system

< br />

Finally, the “build” part of my POM became This one (you can see that it also has a soldering part), it has been a long time since I used it, so I don’t even know if it is already good

< build>
JarName


org.apache.maven.plugins
maven-compiler-plugin
2.4

1.7
1.7
UTF-8



org.apache.maven.plugins
maven-dependency-plugin
2.3


copy-dependencies
package

copy-dependencies


runtime
${project.build.directory}/dist/lib
false
false
true





org.apache.maven.plugins
maven-antrun-plugin
1.6


package


< taskdef name="jfxjar" classname="com.sun.javafx.tools.ant.FXJar"
classpathref="maven.plugin.classpath" />
destfile="$ {project.build.directory}/dist/${project.build.finalName}">









run
< br />




com.oracle
ant-javafx
${javafx.version}
${java.hom e}/../lib/ant-javafx.jar
system


com.oracle
javafx
${javafx.version}
${java.home} /lib/jfxrt.jar
system




org.codehaus.mojo
sonar-maven-plugin
2.0





org.eclipse.m2e
lifecycle-mapping
1.0.0





org.apache.maven. plugins
maven-dependency-plugin
[2.0,)

copy-dependencies












I just asked a question about using javafxpackager to create a JavaFX jar, you can see it here. My problem is that I cannot include the classpath in the manifest. Well, when I am waiting When answering, I tried maven-antrun-plugin. It works well, I can run my application with dependencies, but (there is always one but) only the dependency OUTSIDE my last jar. So it looks like this:

FinalJar.jar
lib
|_{all dependencies here}

My manifest file passes JavaFX- The Class-Path attribute points to the dependency. If I put the dependency in the jar, like I want, it cannot find my dependency. Does it help?

Edit: This is the step of adding dependencies to the jar, which is located in pom.xml:


< groupId>org.apache.maven.plugins
maven-antrun-plugin
1.6


package


classpathref="maven.plugin.classpath" />
destfile="${project.build.directory}/dist/${project. build.finalName}">








< br />





run





com.oracle
ant-javafx
${javafx.version}
${java.home}/../lib/ant-javafx.jar
system


com.oracle
javafx
${javafx.version}
${java.home}/lib/jfxrt.jar
system


Finally, the “build” part of my POM became this (you can see it also has a welding part), since It’s been a long time since I used it, so I don’t even know if it is ready


JarName


org.apache.maven.plugins
maven-compiler-plugin
2.4

1.7
1.7
UTF-8



org.apache.maven.plugins
maven-dependency-plugin
2.3< /version>


copy-dependencies
package

copy-dependencies


runtime
${ project.build.directory}/dist/lib
false
false
true





org.apache.maven.plugins
maven-antrun-plugin
1.6< br />

package


classpathref="maven.plugin.classpath" />
destfile="${project.build.directory }/dist/${project.build.finalName}">






< /configuration>

run





com.oracle
ant-javafx
${javafx.version }
${java.home}/../lib/ant-javafx.jar
system


com.oracle
javafx< br /> ${javafx.version}
${java.home}/lib/jfxrt.jar
system




org.codehaus.mojo
sonar-maven-plugin
2.0


< br />

org.eclipse.m2e
lifecycle-mapping
1.0.0





org.apache.maven.plugins
maven -dependency-plugin
[2.0,)

copy-dependencies






< br />





WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 2362 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.