[
https://issues.apache.org/jira/browse/MSHADE-265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17648685#comment-17648685
]
Sebastian Stenzel commented on MSHADE-265:
------------------------------------------
Not sure if this is even on the roadmap, but for the record, I want to add
something that needs to be taken care of by when applying package relocations:
The jar tool adds the optional {{ModulePackages}} attribute to the
{{{}module-info.class{}}}. If it is present, it is required to contain an
exhaustive list of the jar's packages, because the class loader uses this as
the single source of truth and ignores any unlisted packages.
I.e. when relocating packages, this attribute needs to be updated _or_ deleted
(so the class loader falls back to scanning the whole jar). Otherwise a shaded
jar will cause {{NoClassDefFoundErrors}} at runtime.
See Alan Bateman's comment on [this StackOverflow
post|https://stackoverflow.com/q/51532510/4014509]:
{quote}Tools or plugins doing this must update the value of the ModulePackages
attribute.
{quote}
> correct merging of module-info in shades
> ----------------------------------------
>
> Key: MSHADE-265
> URL: https://issues.apache.org/jira/browse/MSHADE-265
> Project: Maven Shade Plugin
> Issue Type: Improvement
> Reporter: Romain Manni-Bucau
> Priority: Trivial
>
> Should work by merging of the encountered module info jut also automatic
> module name in manifest. The hard part being removing the not needed entries
> which are sometimes not simply the ones of the included classes - SPI need it
> still
--
This message was sent by Atlassian Jira
(v8.20.10#820010)