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

MetaInfServicesHandler catalog is not cleared between invocations in multimodule projects

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.5.2, 2.5.5
    • 3.0.0
    • None
    • None

    Description

      I have a multi-module project (Apache Phoenix) that is using the assembly plugin to build two unrelated uberjars.

      [INFO] Apache Phoenix ..................................... SUCCESS [  3.705 s]
      [INFO] Phoenix Core ....................................... SUCCESS [01:30 min]
      [INFO] Phoenix - Flume .................................... SUCCESS [  2.832 s]
      [INFO] Phoenix - Pig ...................................... SUCCESS [  2.579 s]
      [INFO] Phoenix Query Server Client ........................ SUCCESS [  0.906 s]
      [INFO] Phoenix Query Server ............................... SUCCESS [ 33.841 s]
      [INFO] Phoenix - Pherf .................................... SUCCESS [ 14.286 s]
      [INFO] Phoenix - Spark .................................... SUCCESS [ 33.687 s]
      [INFO] Phoenix Assembly ................................... SUCCESS [01:29 min]

      The first uberjar is built by the Assembly module and consists of classes from Core, Flume, Pig, Spark, and sundry dependencies. The second is built in the Query Server module and consists of Core, Query Server, and Query Server Client modules. Both Core and Query Server Client modules provide a META-INF/services/java.sql.Driver file. As you can see above, the Query Server module is assembled first, and then the Assembly module.

      Initially I added the metaInf-services containerDescriptorHandler to the Assembly module (PHOENIX-1995) and everything worked as expected. Later, I added it also to the Query Server module (PHOENIX-2013). After that, I noticed that the resulting java.sql.Driver file packaged by Assembly contains entries for this file from Query Server.

      After much mucking about with dependencies, excludes, etc, I decided to mvnDebug the build. With a breakpoint in AbstractLineAggregatingHandler#addToArchive, sure enough, I see all the catalog entries from the first assembly invocation in the second invocation. I also see that the instance of MetaInfServicesHandler and it's catalog instance are identical between module invocations. Breakpoints at AbstractLineAggregatingHandler#getCatalog and AbstractLineAggregatingHandler#setCatalog are never hit, indicating that nothing external is tinkering with the catalog or its contents.

      I think the instance of MetaInfServicesHandler should be either reset or re-instantiated between module invocations.

      Attachments

        Issue Links

          Activity

            People

              krosenvold Kristian Rosenvold
              ndimiduk Nick Dimiduk
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: