I want to understand modularity in java. When compiling my app I have a ResolutionException

58 Views Asked by At

I have 2 separate javafx modular projects created with Gradle and IntelliJ Idea. The first one is an app I will name it A. The second is a library, I will name it B.

I want to use library B in my app A, and when I run my app, the Gradle task main fail with this message:

Error occurred during initialization of boot layer.
java.lang.module.ResolutionException: 
  Module org.kasburn.moduleB contains package javafx.concurrent,
  module javafx.graphics exports package javafx.concurrent to org.kasburn.moduleB.

Content of module-info.java of project A:

module org.kasburn.moduleA {
    requires javafx.fxml;
    requires java.desktop;
    requires javafx.controls;
    requires org.kasburn.moduleB;
}

Content of module-info.java of project B:

module org.kasburn.moduleB {
    requires javafx.graphics;
    exports org.kasburn.moduleB;
}

I don't know what to do to resolve it. Project B is built as an artifact jar and the two projects really needs javafx.controls and javafx.graphics.

I can't remove javafx.controls nor javafx.graphics , and I have test with transitive keyword but no visible effect.

0

There are 0 best solutions below