Open HGuillemet opened 5 years ago
The javafx artifacts for each module like javafx.controls
come in an empty platform-neutral jar and up to three platform jars.
Notice, however, that there is only one pom per module. When calling the "empty" jar, the pom will resolve the platform (classifier, like javafx-controls:win
) and the module dependencies (like javafx.graphics
). For these dependencies, you will be resolving their pom, in the same way.
Adding the classifier to those dependencies, like:
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11.0.2</version>
<classifier>${javafx.platform}</classifier>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>11.0.2</version>
<classifier>${javafx.platform}</classifier> <--- This will be added
</dependency>
</dependencies>
won't necessary fix the issue, as you still have an empty "non-modular" jar for javafx-controls
in the first place.
You might want to have a look at the javafx-maven-plugin
: https://github.com/openjfx/javafx-maven-plugin. It does include a jlink
goal, and deals with the empty artifacts.
Sorry for not following up earlier. Since I have a working solution by excluding transitive dependencies this was not a priority for me.
I don't understand your point. The problem with jlink appears when there is a maven dependency towards the empty jar, since all dependency jars become JPMS modules in the module path. If you add the classifier line as suggested in the poms AND if the application pom declares dependency with the classifier, there won't be any empty jar in the dependency tree. And using the javafx-maven-plugin shouldn't be necessary. Am I wrong ?
The poms shipped with the artifacts on maven central show dependencies like:
When running the jlink maven plugin, this results in jlink trying to include modules
javafx-graphics.jar
instead ofjavafx-graphics-platform.jar
and jlink fails withIs there any reason not to include the platform classifier in all dependencies of javafx artifacts toward other javafx artifacts ?
As a workaround, I had to exclude the transitive dependencies in my project with configurations like :