[
https://issues.apache.org/jira/browse/MSHADE-300?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16634432#comment-16634432
]
Rafael Winterhalter commented on MSHADE-300:
--------------------------------------------
In the mean time, I think that I have found a cleaner way to achieve this.
Instead of adding the module-info.class file to the target folder, I inject it
into the shaded jar directly. I had another use case where I produced both a
"normal" and a shaded jar where I required two module descriptors and this is
not possible using the approach that I suggested here. Instead, I published a
plugin to do so: [https://github.com/raphw/modulemaker-maven-plugin]
I think this is the better approach compared to merging this into shade after
trying out both approaches.
> Allow retention of module-info class by property
> ------------------------------------------------
>
> Key: MSHADE-300
> URL: https://issues.apache.org/jira/browse/MSHADE-300
> Project: Maven Shade Plugin
> Issue Type: New Feature
> Affects Versions: 3.2.0
> Reporter: Rafael Winterhalter
> Priority: Major
> Attachments: MSHADE300.patch
>
>
> Currently, the shader removes any module-info.class file that is found during
> the shading process. This makes perfect sense as the integrity of the
> module-info class file breaks as a result of the relocation and any potential
> renaming.
> Many library vendors that use the shade plugin do so to import minor
> dependencies into their namespace. In my case, I depend on ASM and use
> another Maven plugin to generate a module-info.class file which does not
> require ASM and would work correctly. Unfortunately, this working
> module-info.class file is filtered out by the shade plugin.
> To overcome this limitation, I suggest adding a 'retainModuleInfo' property
> that allows for the retention of the module-info.class file that is extracted
> from the main artifact. I understand that this might be an edge case but
> given the module system only being partially adopted it would help some
> low-level library vendors like myself a lot if this feature would be included
> in the plugin.
> I have attached a patch file that implements this feature and it only
> requires minimal changes in the plugin. I have also validated that this
> feature works for my project (Byte Buddy).
> If you could merge and release this extension, I would hope to include module
> descriptors in Byte Buddy in the upcoming Java 11-compatible release. Thanks
> a lot!
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)