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

            Bug ID: 63555
           Summary: embedded jar manifests missing automatic module names
           Product: Tomcat 9
           Version: 9.0.x
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Packaging
          Assignee: dev@tomcat.apache.org
          Reporter: rob.pl...@dai.co.uk
  Target Milestone: -----

I'm happy to report that Tomcat 9 has been working reliably embedded in a
project using the Java 9+ module system over the past year. However, the
embedded jars do not provide the Automatic-Module-Name entry in their
MANIFEST.MF files. The result is that maven generates warnings -- and valid
warnings -- that the module names are unstable. For example:

***********************************************************************************************************************************************************************
* Required filename-based automodules detected: [tomcat-embed-el-9.0.21.jar].
Please don't publish this project to a public artifact repository! *
***********************************************************************************************************************************************************************

This limits downstream open sources projects from using tomcat, which should
heed this warning, and may create incompatibilities in future if the jar file
names change.

The affected maven modules are those in the org.apache.tomcat.embed group which
may be referenced from an embedded application, as well as some related jars
such as tomcat-jdbc which can be used embedded:

tomcat-embed-websocket
tomcat-embed-el
tomcat-embed-jasper
tomcat-embed-core
tomcat-jdbc

An obvious solution would be to put Automatic-Module-Names in each of these
jars at build time, to match maven's fallback filename-based automodule names.
That is to say, replace the hyphens with periods:

Automatic-Module-Name: tomcat.embed.websocket

With this approach, the Maven warning is resolved, and the existing
filename-based automatic module names become stable.

But there is a question of whether the embedded packaging should really include
the word "embed", when some of these jars are a repackaging of the code from
the tomcat webapp server packages. Alternative module names might make more
sense, and provide better compatibility with the non-embedded version of tomcat
if Tomcat is ever made fully modular. Example: tomcat-embed-websocket would
perhaps be better as "tomcat.websocket", and tomcat-embed-el would be
"apache.el" or "org.apache.el" as internally it doesn't reference tomcat... And
so on.

If taking this approach, which I can entirely appreciate, then I think
implementing it sooner rather than later would be wise. The long filename-based
automatic modules are relied upon, the more projects may come to rely
incorrectly upon the unstable filename-based naming, and break in future.

An example of a similar issue as resolved in other popular open source
projects: https://github.com/FasterXML/jackson-core/issues/397

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

Reply via email to