Enable the search for module-info.class
file in the META-INF/versions/
sub-directories of a JAR file.
#11153
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
By default,
java.util.jar.JarFile
does not search for resources inMETA-INF/versions/
sub-directories. For enabling this feature, we need to specify a version greater than Java 8 to the constructor. The core change of this pull request is this line:The rest is for answering the question: "which target Java version"? An easy approach would have been to set
target
unconditionally toRuntime.version()
, i.e. the Java version on which Maven is running. This pull request rather allows configuration, with the intend to set the target version to the value of the--release
target option. This value can determine whether a dependency will be placed on the class-path or on the module-path. For example, if themodule-info.class
entry of a JAR file exists only in theMETA-INF/versions/17/
sub-directory, then the default location of that dependency will be the module-path only if the--release
option is equal or greater than 17.This pull request fixes the initial topic of apache/maven-compiler-plugin#966.