jdeps command use with `--multi-release` option failed

2.4k Views Asked by At

I ran the followings commands, but I got the same errors:

$ jdeps --generate-module-info . --multi-release 9 libs/log4j-core-2.11.1.jar
Error: log4j-core-2.11.1.jar is a multi-release jar file but --multi-release option is not set

$ jdeps --generate-module-info . --multi-release 10 libs/log4j-core-2.11.1.jar
Error: log4j-core-2.11.1.jar is a multi-release jar file but --multi-release option is not set

$ jdeps --generate-module-info . --multi-release 11 libs/log4j-core-2.11.1.jar
Error: log4j-core-2.11.1.jar is a multi-release jar file but --multi-release option is not set

$ jdeps --generate-module-info . libs/log4j-core-2.11.1.jar
Error: log4j-core-2.11.1.jar is a multi-release jar file but --multi-release option is not set

What's the problem with the above commands?

Follow others commands about my environment:

$ java --version
openjdk 10.0.2 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)

$ javac --version
javac 10.0.2

$ jdeps --version
10.0.2

Same error with the java-11-oracle.

2

There are 2 best solutions below

2
On BEST ANSWER

There's a bug with --multi-release option to work with modules

jdeps fails when executing on a non multi release jar and the --class-path contains multi release jars. The opposite is also true. jdeps fails when executing on a multi release jar with the appropriate --multi-release flag is set and the --class-path contains non multi release jars.

Which summarizes the issue:

This basically makes multi-release jars unusable with modules.

0
On

JDK-8229396 fixes jdeps --generate-module-info option to properly use the version specified to --multi-release option to parse the given multi-release JAR. This has been fixed in 14. Please try out the EA build in coming weeks.