gradlex-org / extra-java-module-info

A Gradle 6.8+ plugin to use legacy Java libraries as Java Modules in a modular Java project
Apache License 2.0
100 stars 6 forks source link

Version 1.6 broke multi module builds #104

Closed crschnick closed 7 months ago

crschnick commented 7 months ago

When upgrading to 1.6 or above, I always encounter the following error when building a multi-module project:

> Could not resolve all files for configuration ':app:runtimeClasspath'.
   > Failed to transform xpipe-beacon.jar (project :beacon) to match attributes {artifactType=jar, javaModule=true, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=21, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for ExtraJavaModuleInfoTransform: C:\Projects\xpipe\xpipex\beacon\build\libs\xpipe-beacon-8.0-SNAPSHOT.jar.
         > Transform output C:\Projects\xpipe\xpipex\beacon\build\libs\xpipe-beacon-8.0-SNAPSHOT.jar must exist.
   > Failed to transform xpipe-core.jar (project :core) to match attributes {artifactType=jar, javaModule=true, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=21, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for ExtraJavaModuleInfoTransform: C:\Projects\xpipe\xpipex\core\build\libs\xpipe-core-8.0-SNAPSHOT.jar.
         > Transform output C:\Projects\xpipe\xpipex\core\build\libs\xpipe-core-8.0-SNAPSHOT.jar must exist.

The dependency setup of :app looks like this:

dependencies {
    implementation project(':core')
    implementation project(':beacon')

It works with 1.5, so this is probably related to https://github.com/gradlex-org/extra-java-module-info/issues/78

jjohannes commented 7 months ago

Yes this is very likely related to #78. Unfortunately, the timing of transformations is still a general Gradle issue. By certain (miss) configuration they are triggered too early and then things are in a bad state.

Here is one example of how this can happen: https://github.com/johnrengelman/shadow/issues/882

In your case, it could be another plugin causing the problem or something in your build configuration.

I still think the change mad to resolve #78 is "right", as it previously just masked another problem in the setup.

If you could share a reproducer of the issue, I am happy to take a look though.

crschnick commented 7 months ago

So this is now also fixed by avoiding any early calls to the runtimeClasspath.

It would be nice if the error messages could provide more detail here as well.

jjohannes commented 7 months ago

Happy to hear that you were able to solved this in you setup. Follow up: #106