Search code examples
javagradlejava-module

Gradle java 9+ conflict in resource folder name


I have library using JavaFX, which has resource folder "fxml". Built by gradle using java 9+ as lib.jar, I include it into my other project, which is built in the same way.

Unfortunately there si following issue:

Error occurred during initialization of boot layer
java.lang.LayerInstantiationException: Package fxml in both module A (my current project I am trying to build) and module B (lib.jar)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':run'.
> Process 'command '/usr/lib/jvm/openjdk-12/bin/java'' finished with non-zero exit value 1

It is really complaining about the "fxml" folder in resources, because when I rename the folder, this issue is gone.

I would like to ask how to resolve this conflict using gradle, I found a lot of articles about how to resolve dependencies but none about folder names.


Solution

  • Resource folders and Java packages are essentially the same. The problem is that with your project you add additional resources to a package that is already present in the JDK. That is prohibited.

    Basically rename your resources folder/package and you're done.