Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Module ___ not found" for run task (Java 11 with Kotlin/Groovy plugin applied) #118

Open
tlinkowski opened this issue Sep 14, 2019 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@tlinkowski
Copy link
Collaborator

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 getting build/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:

  1. don't have mergeClasses tasks
  2. have build/classes/merged on the module path

it seems to me that the two calls to isMergeRequired return different results:

  1. returns false:

    public void configureMergeClassesAfterEvaluate() {
    if (!mergeClassesHelper().isMergeRequired()) {
    return;
    }

  2. returns true:

    public FileCollection getMergeAdjustedClasspath(FileCollection classpath) {
    if (!isMergeRequired()) {
    return classpath;
    }

I haven't yet confirmed if they really do return different results, and - if so - why it happens.

@tlinkowski tlinkowski added the bug Something isn't working label Sep 14, 2019
@tlinkowski tlinkowski changed the title "Module ___ not found" for run when targeting JDK 11 "Module ___ not found" for run task (Java 11 with Kotlin/Spock plugin applied) Sep 14, 2019
@tlinkowski tlinkowski changed the title "Module ___ not found" for run task (Java 11 with Kotlin/Spock plugin applied) "Module ___ not found" for run task (Java 11 with Kotlin/Groovy plugin applied) Sep 14, 2019
@yuliu2016
Copy link

I believe that I have had the same/a related issue, since changing the version to 1.6.0 in my project - build/classes/merged is now part of the module-path while build/classes/java and build/classes/kotlin are now not part of the module-path (which it was when I used 1.5.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants