You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2023/06/07 13:30:05 UTC

[Bug 66631] New: Consider moving module-info.class to META-INF/versions/9

https://bz.apache.org/bugzilla/show_bug.cgi?id=66631

            Bug ID: 66631
           Summary: Consider moving module-info.class to
                    META-INF/versions/9
           Product: Tomcat 9
           Version: 9.0.75
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Packaging
          Assignee: dev@tomcat.apache.org
          Reporter: michaelo@apache.org
  Target Milestone: -----

Created attachment 38580
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=38580&action=edit
Report output

While working on a library upgrade to Tomcat 9 Maven Shared JAR in Maven
Project Info Reports Plugin dependencies goal lists all Tomcat 9 JARs as Java 9
requirement because of:
osipovmi@deblndw011x:~/.m2/repository/org/apache/tomcat/tomcat-jni/9.0.75
$ tar tzf tomcat-jni-9.0.75.jar | grep module-info.class
module-info.class
because this one uses Java 9 BC while rest is on 8.

According to https://docs.oracle.com/en/java/javase/20/docs/specs/jar/jar.html,
the following is possible:
A modular multi-release JAR file is a multi-release JAR file that has a module
descriptor, module-info.class, in the top-level directory (as for a modular JAR
file), or directly in a versioned directory.

My request is to move this file to META-INF/versions/9

To give class analyzers a chance to properly process classes and group them by
version.

Related: https://github.com/apache/maven-shared-jar/pull/21

Note: I assume that this applies to all Tomcat 9 JARs.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 66631] Consider moving module-info.class to META-INF/versions/9

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66631

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
Yes, this applies to most of the Tomcat 9 JARs.

Tomcat uses BND to insert the module-info.class file.

A review of the BND documentation and source code indicates the location of the
file is hard coded (so is the class version but that has to be >= Java 9 to
specify the module).

Including a module-info.class file in a JAR otherwise compiled for Java 8 is a
fairly common approach to initial JPMS support. I wonder if updating the logic
in the Maven Project Info Reports Plugin to account for this wouldn't be a
better approach.

Another option would be requesting BND to add an option to insert
module-info.class under META-INF/versions/9 but I'm not sure "so the Maven
Project Info Reports Plugin gets the right answer" would be a sufficient
justification to get that implemented.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 66631] Consider moving module-info.class to META-INF/versions/9

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66631

Michael Osipov <mi...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |michaelo@apache.org

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 66631] Consider moving module-info.class to META-INF/versions/9

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66631

--- Comment #2 from Michael Osipov <mi...@apache.org> ---
(In reply to Mark Thomas from comment #1)
> Yes, this applies to most of the Tomcat 9 JARs.
> 
> Tomcat uses BND to insert the module-info.class file.
> 
> A review of the BND documentation and source code indicates the location of
> the file is hard coded (so is the class version but that has to be >= Java 9
> to specify the module).
> 
> Including a module-info.class file in a JAR otherwise compiled for Java 8 is
> a fairly common approach to initial JPMS support. I wonder if updating the
> logic in the Maven Project Info Reports Plugin to account for this wouldn't
> be a better approach.
> 
> Another option would be requesting BND to add an option to insert
> module-info.class under META-INF/versions/9 but I'm not sure "so the Maven
> Project Info Reports Plugin gets the right answer" would be a sufficient
> justification to get that implemented.

Thanks, Mark. MPIR with Maven Shared JAR was just an example of class file
analyzers. There are likely others which might trip over this and report the
entire JAR as Java 9 which it isn't obviously.

I'd like to get this solved rather in BND than Maven Shared JAR which is just
the affected downstream analyzer library.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 66631] Consider moving module-info.class to META-INF/versions/9

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66631

--- Comment #3 from Michael Osipov <mi...@apache.org> ---
I have raised https://github.com/bndtools/bnd/issues/5687. Let's see what they
say. A workaround is to unpack JARs, move the class and repack :-(

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org