maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Sand (JIRA)" <>
Subject [jira] [Commented] (MSHADE-229) Add ability for ServicesResourceTransformer to rename files
Date Wed, 10 Aug 2016 03:25:20 GMT


Richard Sand commented on MSHADE-229:

Agreed, sorry it is a duplicate of 221. Hopefully the patch gets incorporated soon.

> Add ability for ServicesResourceTransformer to rename files
> -----------------------------------------------------------
>                 Key: MSHADE-229
>                 URL:
>             Project: Maven Shade Plugin
>          Issue Type: Improvement
>    Affects Versions: 2.4.3
>            Reporter: Richard Sand
>         Attachments: shade srt.patch
> The ServicesResoureTransformer can transform the contents of files in META-INF/services
- however, often the names of these files also follow the package hierarchy. Simple example
is commons-logging, where it creates a service META-INF/services/org.apache.commons.logging.LogFactory
containing the full name of the default LogFactory class. So in addition to transforming the
file contents, we want to transform the file names as well.
> Sometimes this is a requirement to create a working shaded jar. For example, if you are
using Jersey JAX-RS, or any project using Glassfish HK2, you will find that your shaded jar
fails because these services files are now expected to have been renamed along with the class
relocation rules.
> I've added a patch to this case that augments ServicesResourceTransformer to add this
capability. It adds a new Boolean "renamFiles" - which defaults to "false" to preserve existing
functionality. But when sent to true, it will send each resource filename through the relocators,
so that "META-INF\services\org.glassfish.hk2.extension.ServiceLocatorGenerator" is renamed
to "", as well
as having its contents updated as well. With this fix In place, I've easily encapsulated Jersey
and my logging framework into a shaded jar that works just fine.
> The fix is very easy and only a few lines of code and provides a useful new feature.
I hope the development community agrees and accepts this patch into the next release

This message was sent by Atlassian JIRA

View raw message