Arquillian
Arquillian

Reputation: 143

Jigsaw Maven JavaFX Project - How to export?

I am developing a JavaFX application in a single maven module using Java modules (Jigsaw). My app runs and I don't have errors or warnings in Eclipse. Now I want to export a running jar.

I tried this: mvn clean install javafx:jlink

And got this error message: "automatic module cannot be used with jlink: org.slf4j from file:///home/user1/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar"

This is how my module-info.class looks like:

    //needed exports
    exports myapp to javafx.graphics;
    exports myapp.gui to javafx.fxml;
    exports myapp.model to javafx.fxml;
    opens myapp.gui to javafx.fxml;

    // javafx
    requires transitive javafx.base;
    requires transitive javafx.controls;
    requires transitive javafx.fxml;
    requires transitive javafx.graphics;

    // log4j
    requires org.apache.logging.log4j.core;
    requires org.apache.logging.log4j;
    requires org.apache.logging.log4j.slf4j;
    requires junit;
    requires org.slf4j;

Any idea on how to export a runnable jar?

Upvotes: 0

Views: 156

Answers (2)

Arquillian
Arquillian

Reputation: 143

Ok jlink still had trouble with it.

This is the solution https://leward.eu/2020/01/20/java-module-slf4j-jlink-javafx.html

Using a newer slf4j (alpha 2.x).

It simply sums up to every module needing to be a jigsaw module project...

Upvotes: 0

mipa
mipa

Reputation: 10640

The answer is pretty simple. Automatic modules are just not supported by jlink. Have a look here to see how this can be circumvented: https://github.com/dlemmermann/JPackageScriptFX

Upvotes: 0

Related Questions