kordamp / jdeps-gradle-plugin

Run JDeps on a Gradle build
Apache License 2.0
35 stars 10 forks source link

Error: *.jar is a multi-release jar file but --multi-release option is not set #10

Closed elect86 closed 2 years ago

elect86 commented 5 years ago

As titled, I'm trying to run it on a multi-release jar (lwjgl), but I get:

Error: lwjgl-jemalloc-3.2.3-SNAPSHOT-natives-windows.jar is a multi-release jar file but --multi-release option is not set

elect86 commented 5 years ago
* What went wrong:
Plugin [id: 'org.kordamp.gradle.jdeps', version: '0.7.0'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'org.kordamp.gradle.jdeps:org.kordamp.gradle.jdeps.gradle.plugin:0.7.0')
  Searched in the following repositories:
    Gradle Central Plugin Repository

I guess it'll take a while to have it available?

aalmiray commented 5 years ago

Publication to the Plugin Portal failed on the first try. The plugin should be up.

elect86 commented 5 years ago

Thanks, it's there

I still have the same problem, though

Did I do it right?

aalmiray commented 5 years ago

No. There regex you used (lwjgl*) matches "lwjg", "lwjgl", "lwjgll", "lwjglll", ... That's clearly not what you need. Use lwjgl.* but bear in mind this will match lwjgl_native too.

elect86 commented 5 years ago

Uh, ok

I still get Error: lwjgl-3.2.3-SNAPSHOT.jar is a multi-release jar file but --multi-release option is not set

Which regex shall I use? lwjgl-* or lwjgl-3.* don't seem to work..

aalmiray commented 5 years ago

Hmm, if OTOH the multiRelease property is set

jdepsReport {
    multiRelease = true
}

Then the error is

Error: kotlin-stdlib-common-1.3.41.jar is not a multi-release jar file but --multi-release option is set

It appears that the multiReleaseJarsettings are not applied transitively, but if multiRelease is set then all JARs (even those that are not multi-release) will be checked. It seems that the jdeps command is too strict, based on the help from JDK 11:

  --multi-release <version>     Specifies the version when processing
                            multi-release jar files.  <version> should
                            be integer >= 9 or base.

This does not seem to imply that a strict check will be executed.

aalmiray commented 5 years ago

I don't get it. I've confirmed that the plugin generates the following command

jdeps --multi-release 11 -jdkinternals --module-path /Users/aalmiray/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.3.41/e24bd38de28a326cce8b1f0d61e809e9a92dad6a/kotlin-stdlib-1.3.41.jar:/Users/aalmiray/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-jemalloc/3.2.3-SNAPSHOT/8e9b50900c5ca9e32d147048beb565f0fde1d48c/lwjgl-jemalloc-3.2.3-SNAPSHOT.jar:/Users/aalmiray/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl/3.2.3-SNAPSHOT/bcd3da451427975d3efa8c0d17c3d36820749abd/lwjgl-3.2.3-SNAPSHOT.jar:/Users/aalmiray/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.3.41/2ecf4aa059427d7186312fd1736afedf7972e7f7/kotlin-stdlib-common-1.3.41.jar:/Users/aalmiray/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar:/private/tmp/kool/build/classes/java/main /Users/aalmiray/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl/3.2.3-SNAPSHOT/bcd3da451427975d3efa8c0d17c3d36820749abd/lwjgl-3.2.3-SNAPSHOT.jar

If said command is executed on a sheel you get the desired result. However if the command is executed by the plugin then you get

Error: lwjgl-3.2.3-SNAPSHOT.jar is a multi-release jar file but --multi-release option is not set
elect86 commented 5 years ago

https://bugs.openjdk.java.net/browse/JDK-8210502

elect86 commented 5 years ago

multiRelease = true returns Cannot cast object 'true' with class 'java.lang.Boolean' to class 'java.lang.Integer'

Ps: how can I get the generated command?

aalmiray commented 5 years ago

Err my mistake, multiRelease must be set to an Integer not a Boolean. I've pushed diagnostics code. You can clone this repository and push a SNAPSHOT release to mavenLocal, configure it and then invoke gradle cleanJdepsReport jdepReport -i

elect86 commented 5 years ago

no problem

I find it a little overkill.. I think also other users may benefit from the generated command, would it be better to print it out in console?

aalmiray commented 5 years ago

By overkill you mean testing out a local snapshot? It's my policy to never release snapshot versions of plugins and from the looks of it this bug has not been fully fixed thus a 0.7.1 release should not be posted yet.

elect86 commented 5 years ago

yep, I have no idea how to do this "push a SNAPSHOT release to mavenLocal, configure it "

lwjgl uses oss.sonatype.org to publish snapshots, could something similar be done also for gradle plugins?

aalmiray commented 5 years ago

Here's how you can do it

  1. git clone https://github.com/aalmiray/jdeps-gradle-plugin
  2. cd jdeps-gradle-plugin
  3. gradlew publishToMavenLocal

Then edit kool/settings.gradle to make it look like this

pluginManagement {
    repositories {
        jcenter()
        gradlePluginPortal()
        mavenLocal()
    }
}

Finally edit kool/build.gradleand update the version number

id 'org.kordamp.gradle.jdeps' version '0.7.1-SNAPSHOT'
elect86 commented 5 years ago

I cant seem to find it

These are all the tasks I have

aalmiray commented 5 years ago

The cleanJdepsReport task comes from a rule. Have a look at the bottom of gradlew tasks --all and you'll see

Rules
-----
Pattern: clean<TaskName>: Cleans the output files of a task.
elect86 commented 5 years ago

I do see it indeed, but it keeps saying that the command is not found

aalmiray commented 2 years ago

Cannot reproduce with latest. Closing.