iamkenos
iamkenos

Reputation: 1566

JavaFX Maven Plugin: com.zenjava - jfx:jar to include all depedencies?

Is there a way to include all the dependencies WITHIN the generated jar by running the jfx:jar goal for the javafx maven plugin?

Currently, all the project dependencies are getting stored in a folder called 'lib'. enter image description here

I'm looking for a way to generate the javafx executable jar like how the eclipse Project > Export > Runnable Jar settings have this option: enter image description here

Some other info: Currently if I use the jfx:jar the generated jar is ~150kb and will not run unless the dependency libs are present.

However, if I use the eclipse runnable jar export option shown above, the generated jar is ~40,000kb and can run on its own.

My pom:

    <properties>
        <jfx.output.dir>${project.build.directory}/application/</jfx.output.dir>
    </properties>
    .
    .
    .
            <plugins>
                <plugin>
                    <groupId>com.zenjava</groupId>
                    <artifactId>javafx-maven-plugin</artifactId>
                    <version>8.7.0</version>
                    <configuration>
                        <mainClass>my.main.class.Main</mainClass>
                        <jfxAppOutputDir>${jfx.output.dir}</jfxAppOutputDir>
                        <allPermissions>true</allPermissions>
                    </configuration>
                </plugin>
            </plugins>

Upvotes: 2

Views: 4723

Answers (2)

iamkenos
iamkenos

Reputation: 1566

Been a while but I decided to answer this question.
I solved my problem by using another plugin which was not familiar to me as the question was posted.

Hope this helps others!

     <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
            <execution>
                <id>create-executable</id>
                <phase>package</phase>
                <goals>
                    <goal>single</goal>
                </goals>
            </execution>
        </executions>
        <configuration>
            <outputDirectory>${test.pack.dir}</outputDirectory>
            <appendAssemblyId>false</appendAssemblyId>
            <descriptorRefs>
                <descriptorRef>jar-with-dependencies</descriptorRef>
            </descriptorRefs>
            <archive>
                <manifest>
                    <mainClass>my.main.class.Main</mainClass>
                </manifest>
            </archive>
        </configuration>
    </plugin>

Upvotes: 3

suresh choudhary
suresh choudhary

Reputation: 1

        <plugins>
            <plugin>
                <groupId>com.zenjava</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>8.7.0</version>
                <configuration>
                    <mainClass>my.main.class.Main</mainClass>
                    <jfxAppOutputDir>${jfx.output.dir}</jfxAppOutputDir>
                    <allPermissions>true</allPermissions>
                </configuration>
            </plugin>
        </plugins>

This plugin doesnt help to bundle native packing in ubuntu .ie .deb file doesnt work. Java community should work on native bundling.

Upvotes: 0

Related Questions