gradlex-org/extra-java-module-info

No Matching Variant Error

Closed this issue · 2 comments

dph10 commented

I've been using the extra-module-info plugin for many months with no problems.

Unfortunately very recently (not sure the exact date), I started receiving the following error when I try to run any gradle task with any
project that uses this plugin:

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project 'My_Project'.

Could not resolve all artifacts for configuration ':classpath'.
Could not resolve de.jjohannes.gradle:extra-java-module-info:0.9.
Required by:
project : > de.jjohannes.extra-java-module-info:de.jjohannes.extra-java-module-info.gradle.plugin:0.9
> No matching variant of de.jjohannes.gradle:extra-java-module-info:0.9 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally but:
- Variant 'apiElements' capability de.jjohannes.gradle:extra-java-module-info:0.9 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component compatible with Java 9 and the consumer needed a runtime of a component compatible with Java 8
- Variant 'runtimeElements' capability de.jjohannes.gradle:extra-java-module-info:0.9 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component compatible with Java 9 and the consumer needed a component compatible with Java 8

I have tried clearing my gradle caches, and have tried version 0.9, 0.10, and 0.11 of the pluging with gradle versions 6.9.1, 7.2, 7.3, 7.3.3, and version 7.4, but I still receive this error every time.

If I comment out this plugin id in my gradle build file and the extraModuleInfo{} block as well, then I can clean and build with gradle as expected. Any idea what may be causing this problem? As I mentioned everything was working just fine with this plugin until recently.

I'm using Java 15 for most of my projects.

dph10 commented

I figured out the issue, this is not a problem with this plugin.

The problem was caused by my computer being a company owned computer that had updates pushed to it from IT that reset my JAVA_HOME environment variable to use a JAVA-8 version. Even though I have Java 15 selected for my Java toolchain in the gradle build script, when I run any command with the gradle wrapper (./gradlew) I think it uses the old Java 8 version for the gradle wrapper daemon.

Yes the Plugin requires you to run Gradle with Java 9+. Somehow I thought that's reasonable for a Module System plugin. But of course you can run Gradle with Java 8 and still compile modules with a different version of Java.
I will change this in the next release. There is no reason for this limitation.