Tagir Valeev created MSOURCES-144:
-------------------------------------

             Summary: Include sources for multi-release jars
                 Key: MSOURCES-144
                 URL: https://issues.apache.org/jira/browse/MSOURCES-144
             Project: Maven Source Plugin
          Issue Type: Improvement
    Affects Versions: 3.3.0
            Reporter: Tagir Valeev
         Attachments: multirelease.zip

Java 9 introduced multi-release JARs seven years ago (see [JEP 
238|https://openjdk.org/jeps/238]). Since then, Maven support for multi-release 
JARs was gradually improved, and now it's quite easy to create and deploy such 
a project. However, I see a significant unresolved problem: the source files 
for alternative versions of class-files are not automatically added to the 
source jar, and I see no easy way to fix this.

Consider the attached example. It contains two versions of 
com.example.DefaultVersion class, one for Java 8, and one for Java 9. Execute 
`mvn verify`. The resulting multi-release-sample-1.0.jar properly contains 
com/example/DefaultVersion.class as Java 8 compiled version and 
META-INF/versions/9/com/example/DefaultVersion.class as Java 9 compiled 
version. However, the source JAR multi-release-sample-1.0-sources.jar contains 
no Java 9-specific version. I expect that the source jar should add Java 9 
source version under the path 
META-INF/versions/9/com/example/DefaultVersion.java

This has an unpleasant effect: the library sources are incomplete, so the 
library user cannot easily browse them without using decompiler or looking for 
the source repository. This complicates navigation and debugging in IDEs. In 
fact, I've checked dozens of multi-release JARs in Maven Central, and none of 
them contain version-specific sources. It would be great to solve this on the 
maven-source-plugin side, so the library maintainers need only to bump 
source-plugin version to publish the sources properly.

Thank you in advance,
Tagir Valeev.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to