Uploaded image for project: 'Maven Shade Plugin'
  1. Maven Shade Plugin
  2. MSHADE-304

Include specific files or directories for transformation - IncludeResourceTransformer?

    XMLWordPrintableJSON

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?

       

      Attachments

        1. default
          0.4 kB
          Alex

        Activity

          People

            Unassigned Unassigned
            exas Alex
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: