AbstractBinaryModuleInfoParser picks the versioned descriptor of a multi-release jar, and since #236 of a multi-release output directory, by counting down from the version of the JDK that runs the build. The version that matters is the one the code is compiled for:
- On a Java 8 runtime compiling through a Java 9+ toolchain (Maven 3.9 on JDK 8),
META-INF/versions/<N>/module-info.class is never found, so the jar or directory is treated as a filename-based automatic module or put on the classpath.
- On a newer runtime compiling with a lower
--release, a descriptor from a version above that release can be picked.
Proposal: add a release (or Java version) setting to ResolvePathsRequest, defaulting to the running JDK, and pass it to getModuleDescriptor(Path, JavaVersion) and to the directory check in LocationManager.resolvePath. Callers such as maven-compiler-plugin would set it from release/target.
AbstractBinaryModuleInfoParserpicks the versioned descriptor of a multi-release jar, and since #236 of a multi-release output directory, by counting down from the version of the JDK that runs the build. The version that matters is the one the code is compiled for:META-INF/versions/<N>/module-info.classis never found, so the jar or directory is treated as a filename-based automatic module or put on the classpath.--release, a descriptor from a version above that release can be picked.Proposal: add a
release(or Java version) setting toResolvePathsRequest, defaulting to the running JDK, and pass it togetModuleDescriptor(Path, JavaVersion)and to the directory check inLocationManager.resolvePath. Callers such as maven-compiler-plugin would set it fromrelease/target.