Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
3.2.1
-
None
Description
Background
I am working at a project with the DI framework HK2.
With HK2 it is possible to use hk2-metadata-generator to generate a file ("META-INF/hk2-locator/default") containing all annotated @Service classes (and @ConfiguredBy annotations) for the auto-discovery feature in HK2.
For the configuration part (@ConfiguredBy) of HK2 i am using maven dependency hk2-configuration-integration (org.glassfish.hk2).
See for more details also:
https://javaee.github.io/hk2/configuration.html
https://javaee.github.io/hk2/inhabitant-generator.html
Example @ConfiguredBy annotation: https://github.com/eclipse-ee4j/glassfish-hk2/tree/master/examples/configuration
Issue/Improvement
With maven-shade i was able to configure relocation for specific dependencies which might be conflicting when used in other projects, which is a really cool feature i have to say!
Only one manual step is now necessary for me (scripted at the moment) to adapt the generated file "META-INF/hk2-locator/default" and update the JAR to have a proper working JAR.
See also attached example file default (note the org.glassfish.hk2 scope defined there, which would require transformation/renaming i.e. org.shaded.glassfish..).
Maybe i am missing something which already exists with maven shade plugin, but i was not able to include a custom file to the transformation/relocation process, like in my described situation.
I also tried to use "IncludeResourceTransformer" but when looking at the code no transformation is done there, it is just used for copying artifacts as far as i can tell? The name is a bit misleading, isn't it?