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

ServicesResourceTransformer incorrectly ignores given Relocators

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 3.0.0
    • Labels:
      None

      Description

      When using the ServicesResourceTransformer in conjunction with relocators for classes that have META-INF/services/ entries, the behavior of the Shade Plugin is unexpected because those services files entries do not get relocated.

      For example:

      Relocator: org.foo.Clazz to org.foo.shaded.Clazz
      Services files: META-INF/services/org.foo.Clazz

      We would expect a services file at META-INF/services/org.foo.shaded.Clazz in the shaded jar, but that does not happen (the file remains at META-INF/services/org.foo.Clazz) since the ServicesResourceTransformer ignores the given Relocators.

        Issue Links

          Activity

          Hide
          traskstalnaker Trask Stalnaker added a comment -

          I just ran into this issue also, please see proposed patch. Thanks.

          Show
          traskstalnaker Trask Stalnaker added a comment - I just ran into this issue also, please see proposed patch. Thanks.
          Hide
          saden1 Sharmarke Aden added a comment -

          The issue is two folds:
          a) the service files must be relocated
          b) the content of the service files must also be relocated.

          The patch submitted by Trask address issue a but not b.

          Show
          saden1 Sharmarke Aden added a comment - The issue is two folds: a) the service files must be relocated b) the content of the service files must also be relocated. The patch submitted by Trask address issue a but not b.
          Hide
          saden1 Sharmarke Aden added a comment -

          This patch addresses both issue a and b mentioned above.

          Show
          saden1 Sharmarke Aden added a comment - This patch addresses both issue a and b mentioned above.
          Hide
          traskstalnaker Trask Stalnaker added a comment -

          The updated patch works for me. Can we get a committer to review? Thanks.

          Show
          traskstalnaker Trask Stalnaker added a comment - The updated patch works for me. Can we get a committer to review? Thanks.
          Hide
          krosenvold Kristian Rosenvold added a comment -

          There is no kind of testcase with this patch. Please look at the projects under src/it/ and make a small testcase

          Show
          krosenvold Kristian Rosenvold added a comment - There is no kind of testcase with this patch. Please look at the projects under src/it/ and make a small testcase
          Hide
          traskstalnaker Trask Stalnaker added a comment -

          Test attached. Please review. Thanks.

          Show
          traskstalnaker Trask Stalnaker added a comment - Test attached. Please review. Thanks.
          Hide
          busbey Sean Busbey added a comment -

          bump. looks like we have everything now? would y'all prefer if the change and test were in a single patch?

          Show
          busbey Sean Busbey added a comment - bump. looks like we have everything now? would y'all prefer if the change and test were in a single patch?
          Hide
          mingtao.zhang Mingtao Zhang added a comment -

          need +1

          Show
          mingtao.zhang Mingtao Zhang added a comment - need +1
          Hide
          lngtmg Paul Polishchuk added a comment -

          Guys, what is the status?
          Can we apply the patch and release new version?

          Show
          lngtmg Paul Polishchuk added a comment - Guys, what is the status? Can we apply the patch and release new version?
          Hide
          lngtmg Paul Polishchuk added a comment -

          The bug is still valid. Checked with 2.4.2

          Show
          lngtmg Paul Polishchuk added a comment - The bug is still valid. Checked with 2.4.2
          Hide
          KostyaSha Kanstantsin Shautsou added a comment - - edited

          Patch is outdated now (not sure). Is there any progress on this issue?

          Show
          KostyaSha Kanstantsin Shautsou added a comment - - edited Patch is outdated now (not sure). Is there any progress on this issue?
          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user KostyaSha opened a pull request:

          https://github.com/apache/maven-plugins/pull/79

          MSHADE-182 Service file should be relocated.

          Fixes issue when service file content is relocated, but file itself didn't.
          Patch content provided by some person in jira ticket.

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/KostyaSha/maven-plugins MSHADE-182

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/maven-plugins/pull/79.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #79


          commit 3acfb9ba3fc22d76d466b112d0ccb04d094f8d24
          Author: Kanstantsin Shautsou <kanstantsin.sha@gmail.com>
          Date: 2016-01-12T23:39:05Z

          MSHADE-182 Service file should be relocated.

          Fixes issue when service file content is relocated, but file itself didn't.
          Patch content provided by some person in jira ticket.


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user KostyaSha opened a pull request: https://github.com/apache/maven-plugins/pull/79 MSHADE-182 Service file should be relocated. Fixes issue when service file content is relocated, but file itself didn't. Patch content provided by some person in jira ticket. You can merge this pull request into a Git repository by running: $ git pull https://github.com/KostyaSha/maven-plugins MSHADE-182 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/maven-plugins/pull/79.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #79 commit 3acfb9ba3fc22d76d466b112d0ccb04d094f8d24 Author: Kanstantsin Shautsou <kanstantsin.sha@gmail.com> Date: 2016-01-12T23:39:05Z MSHADE-182 Service file should be relocated. Fixes issue when service file content is relocated, but file itself didn't. Patch content provided by some person in jira ticket.
          Hide
          KostyaSha Kanstantsin Shautsou added a comment - - edited

          Manually picked attached patch (realisation is the same) plus updated java test. IT duplicates it, but more tests better than one
          Also i verified it on multimodule project with 2 shaded sub-modules and it works fine.
          What is required to resolve this issue?

          Show
          KostyaSha Kanstantsin Shautsou added a comment - - edited Manually picked attached patch (realisation is the same) plus updated java test. IT duplicates it, but more tests better than one Also i verified it on multimodule project with 2 shaded sub-modules and it works fine. What is required to resolve this issue?
          Hide
          KostyaSha Kanstantsin Shautsou added a comment -

          Kindly reminder.

          Show
          KostyaSha Kanstantsin Shautsou added a comment - Kindly reminder.
          Hide
          aheritier Arnaud HERITIER added a comment - - edited

          Fixed in r1728966

          Show
          aheritier Arnaud HERITIER added a comment - - edited Fixed in r1728966
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in maven-plugins #5059 (See https://builds.apache.org/job/maven-plugins/5059/)
          MSHADE-182 Service file should be relocated.
          Submitted by: Trask Stalnaker , Kanstantsin Shautsou (aheritier: http://svn.apache.org/viewvc/?view=rev&rev=1728966)

          • maven-shade-plugin
          • maven-shade-plugin/pom.xml
          • maven-shade-plugin/src/it/MSHADE-182
          • maven-shade-plugin/src/it/MSHADE-182/pom.xml
          • maven-shade-plugin/src/it/MSHADE-182/src
          • maven-shade-plugin/src/it/MSHADE-182/src/main
          • maven-shade-plugin/src/it/MSHADE-182/src/main/resources
          • maven-shade-plugin/src/it/MSHADE-182/src/main/resources/META-INF
          • maven-shade-plugin/src/it/MSHADE-182/src/main/resources/META-INF/services
          • maven-shade-plugin/src/it/MSHADE-182/src/main/resources/META-INF/services/relocateme.Service
          • maven-shade-plugin/src/it/MSHADE-182/verify.groovy
          • maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ServicesResourceTransformer.java
          • maven-shade-plugin/src/test/java/org/apache/maven/plugins/shade/resource/ServiceResourceTransformerTest.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in maven-plugins #5059 (See https://builds.apache.org/job/maven-plugins/5059/ ) MSHADE-182 Service file should be relocated. Submitted by: Trask Stalnaker , Kanstantsin Shautsou (aheritier: http://svn.apache.org/viewvc/?view=rev&rev=1728966 ) maven-shade-plugin maven-shade-plugin/pom.xml maven-shade-plugin/src/it/ MSHADE-182 maven-shade-plugin/src/it/ MSHADE-182 /pom.xml maven-shade-plugin/src/it/ MSHADE-182 /src maven-shade-plugin/src/it/ MSHADE-182 /src/main maven-shade-plugin/src/it/ MSHADE-182 /src/main/resources maven-shade-plugin/src/it/ MSHADE-182 /src/main/resources/META-INF maven-shade-plugin/src/it/ MSHADE-182 /src/main/resources/META-INF/services maven-shade-plugin/src/it/ MSHADE-182 /src/main/resources/META-INF/services/relocateme.Service maven-shade-plugin/src/it/ MSHADE-182 /verify.groovy maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ServicesResourceTransformer.java maven-shade-plugin/src/test/java/org/apache/maven/plugins/shade/resource/ServiceResourceTransformerTest.java
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user KostyaSha closed the pull request at:

          https://github.com/apache/maven-plugins/pull/79

          Show
          githubbot ASF GitHub Bot added a comment - Github user KostyaSha closed the pull request at: https://github.com/apache/maven-plugins/pull/79
          Hide
          sebastian.laskawiec@gmail.com Sebastian Łaskawiec added a comment -

          Hi!

          It looks like this issue will be fixed in 3.0.0. Could you please tell me when 3.0.0 will be available? Or maybe there are any plans to backport it to 2.x.x series?

          Thanks
          Sebastian

          Show
          sebastian.laskawiec@gmail.com Sebastian Łaskawiec added a comment - Hi! It looks like this issue will be fixed in 3.0.0. Could you please tell me when 3.0.0 will be available? Or maybe there are any plans to backport it to 2.x.x series? Thanks Sebastian
          Hide
          sebastian.laskawiec@gmail.com Sebastian Łaskawiec added a comment -

          Any news?

          Show
          sebastian.laskawiec@gmail.com Sebastian Łaskawiec added a comment - Any news?
          Hide
          slowenthal Steven Lowenthal added a comment -

          I see the latest release is 2.4.3. How can I grab a version of 3.0.0 with this fix?

          Show
          slowenthal Steven Lowenthal added a comment - I see the latest release is 2.4.3. How can I grab a version of 3.0.0 with this fix?
          Hide
          kenseb Kenneth Sebastian added a comment -

          I am also is facing this issue.
          Will you guys backport fix to 2.x.x series. ?
          or How can i get latest version 3.0.0 ?

          Show
          kenseb Kenneth Sebastian added a comment - I am also is facing this issue. Will you guys backport fix to 2.x.x series. ? or How can i get latest version 3.0.0 ?
          Hide
          priteshkp Pritesh Patel added a comment -

          Ping – any update on when 3.0.0 will be released or if this patch can be backported?

          Show
          priteshkp Pritesh Patel added a comment - Ping – any update on when 3.0.0 will be released or if this patch can be backported?
          Hide
          torgeir@pobox.com Torgeir Veimo added a comment -

          You can reference the 3.0.0-SNAPSHOT version of the maven plugin if you include the snapshot maven pluginRepository with

          <pluginRepositories>
          <pluginRepository>
          <id>org.apache</id>
          <name>Apache snapshots</name>
          <url>http://repository.apache.org/content/repositories/snapshots</url>
          <snapshots>
          <enabled>true</enabled>
          </snapshots>
          </pluginRepository>
          </pluginRepositories>

          Show
          torgeir@pobox.com Torgeir Veimo added a comment - You can reference the 3.0.0-SNAPSHOT version of the maven plugin if you include the snapshot maven pluginRepository with <pluginRepositories> <pluginRepository> <id>org.apache</id> <name>Apache snapshots</name> <url> http://repository.apache.org/content/repositories/snapshots </url> <snapshots> <enabled>true</enabled> </snapshots> </pluginRepository> </pluginRepositories>

            People

            • Assignee:
              aheritier Arnaud HERITIER
              Reporter:
              thomas_kielbus Thomas Kielbus
            • Votes:
              11 Vote for this issue
              Watchers:
              24 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development