elharo opened a new issue, #557:
URL: https://github.com/apache/maven-jar-plugin/issues/557

   ## Bug
   
   Multi-release JAR detection is broken on Windows because 
`File.separatorChar` is used to build the path prefix, but 
`FileSetManager.getIncludedFiles()` always returns forward-slash paths 
regardless of the operating system.
   
   ## Location
   
   `AbstractJarMojo.java:248-249`:
   
   ```java
   p -> p.startsWith("META-INF" + File.separatorChar + "versions" + 
File.separatorChar)
   ```
   
   On Windows, `File.separatorChar` is `\`, so the prefix becomes 
`META-INF\versions\`, which never matches the forward-slash paths returned by 
`FileSetManager` (e.g. `META-INF/versions/9/module-info.class`).
   
   ## Effect
   
   The `Multi-Release: true` manifest entry is never added for multi-release 
JARs when the build runs on Windows. The JAR is still created but lacks the 
manifest entry, so the JVM will not use versioned classes from 
`META-INF/versions/`.
   
   ## Fix
   
   Replace `File.separatorChar` with the forward slash character `"/"`. JAR 
paths always use forward slashes per the JAR specification, and 
`FileSetManager` normalizes to forward slashes on all platforms.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to