Uploaded image for project: 'Maven Assembly Plugin'
  1. Maven Assembly Plugin
  2. MASSEMBLY-920

ContainerDescriptorHandler for MetaInf-Services breaks folder structure

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.1.1
    • 3.3.0
    • None
    • None

    Description

      I have my own jar-with-dependecies assembly and I need to use the MetaInf-Services ContainerDescriptorHandler to aggregate all services and avoid overriding.

      The plugin does not respect the folder structure inside META-INF/services.

      Camel is a good example of dependecy that can be used to reproduce the problem. It defines its services in a nested folder structure, as in:

      META-INF/services/org/apache/camel/TypeConverter

      What really happens is that the folder structure is indeed created but the TypeConverter file is moved to the root of the services, i.e. META-INF/services

      I had to patch the code and define a custom ContainerDescriptorHandler to fix the problem.

      The fix is straightforward. I simply inherited the provided implementation of MetaInfServiceHandler and coded an overriden version of the following method like this:

          @Override
          protected String getOutputPathPrefix(final FileInfo fileInfo) {
      
              return Paths.get(fileInfo.getName()).getParent().toString() + "/";
          }
      

      All services were properly aggreggated after that.

      This may be the best fix for several related bugs I found online, like this one here: https://stackoverflow.com/questions/37304195/camel-restlet-not-working-in-jar

      Cheer
      Otávio

      Attachments

        1. massembly-920.zip
          2 kB
          Otavio Biasutti

        Issue Links

          Activity

            People

              rfscholte Robert Scholte
              obiasutti Otavio Biasutti
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: