Description
When targeting JDK 11, in a project that has Java, Kotlin, and Groovy plugins applied but has only Java sources, run
task fails with:
java.lang.module.FindException: Module ___ not found
It seems to be due to:
run
task gettingbuild/classes/merged
on a module path (as it shouldn't)mergeClasses
task being absent (as it should)
Example
This behavior is exemplified on a branch of my project, where run
fails like below:
https://travis-ci.com/tlinkowski/UniJ/builds/127633638#L1234-L1236
For a module targeting JDK 8, it works fine, though:
https://travis-ci.com/tlinkowski/UniJ/jobs/235293201#L1271-L1273
In a debugger, I managed to find out that for JDK 11, run
is instrumented with the following command line arguments:
--module-path [...]\UniJ\subprojects\api\pl.tlinkowski.unij.api\build\libs\pl.tlinkowski.unij.api-0.1.0-SNAPSHOT.jar;C:\Users\tlink.gradle\caches\modules-2\files-2.1\org.slf4j\slf4j-simple\1.7.28\cf5f2cf3c31e0e41b68d932d756398a1238d4456\slf4j-simple-1.7.28.jar;[...]\UniJ\subprojects\bindings\collect\pl.tlinkowski.unij.service.collect.jdk10\build\libs\pl.tlinkowski.unij.service.collect.jdk10-0.1.0-SNAPSHOT.jar;[...]\UniJ\subprojects\bindings\misc\pl.tlinkowski.unij.service.misc.jdk11\build\libs\pl.tlinkowski.unij.service.misc.jdk11-0.1.0-SNAPSHOT.jar;[...]\UniJ\subprojects\samples\enduser\pl.tlinkowski.unij.sample.enduser.jdk11\build\classes\merged;[...]\UniJ\subprojects\bundles\pl.tlinkowski.unij.bundle.jdk11\build\libs\pl.tlinkowski.unij.bundle.jdk11-0.1.0-SNAPSHOT.jar;[...]\UniJ\subprojects\api\pl.tlinkowski.unij.service.api\build\libs\pl.tlinkowski.unij.service.api-0.1.0-SNAPSHOT.jar;C:\Users\tlink.gradle\caches\modules-2\files-2.1\org.slf4j\slf4j-api\1.7.28\2cd9b264f76e3d087ee21bfc99305928e1bdb443\slf4j-api-1.7.28.jar;[...]\UniJ\subprojects\samples\enduser\pl.tlinkowski.unij.sample.enduser.jdk11\build\resources\main -agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=50721 --patch-module pl.tlinkowski.unij.sample.enduser.jdk11=[...]\UniJ\subprojects\samples\enduser\pl.tlinkowski.unij.sample.enduser.jdk11\build\resources\main --module pl.tlinkowski.unij.sample.enduser.jdk11/pl.tlinkowski.unij.sample.enduser.jdk11.EndUsage
As you can see, we have build\classes\merged
which shouldn't be there according to the spec from #101. However, :pl.tlinkowski.unij.sample.enduser.jdk11:mergeClasses
task was not run (and was not present, which I confirmed in the debugger).
Conclusions
Because we:
- don't have
mergeClasses
tasks - have
build/classes/merged
on the module path
it seems to me that the two calls to isMergeRequired
return different results:
-
returns
false
:
-
returns
true
:
I haven't yet confirmed if they really do return different results, and - if so - why it happens.