I built a small (hello world style) java 9 project using gradle and the jigsaw plugin.
For a junit test I tried to access some file as a resource, but classLoa
This appears to be a Gradle bug.
When I run Gradle with the -i
option, I see that the actual command it’s executing to run your program includes this:
--patch-module resourceTest=/home/vgr/src/java_9_resource_test/build/classes/java/test
As you can see, it’s including the build/classes
directory, but not the build/resources
directory.
Since the build places the classes and resources in separate places, there is no way to use --patch-module
. The classes and resources must be together, in one file tree or one .jar file.
Whether this is a flaw in the org.gradle.java.experimental-jigsaw plugin, or Gradle itself, I’m not sure.