Maven Shade Plugin
  1. Maven Shade Plugin
  2. MSHADE-86

dependencies of excluded dependencies are included

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Not A Problem
    • Affects Version/s: 1.4
    • Fix Version/s: None
    • Labels:
      None

      Description

      Please let me know if you need a test case here.

      Pom has two executions of shade on separate classifiers. One of them uses excludes to leave some things out. Final jar includes contents of a slew of other artifacts. Dependency:tree shows those artifacts as being dependencies of the excluded artifacts, not the included ones.

        Activity

        Hide
        Benjamin Bentmann added a comment -

        Please let me know if you need a test case here.

        We always do.

        Show
        Benjamin Bentmann added a comment - Please let me know if you need a test case here. We always do.
        Hide
        Benson Margulies added a comment -

        Well, you always do if you agree that this is undesirable behavior . If your reply has been 'that's what we intended', I would have been happy not to have troubled with a test case.

        Show
        Benson Margulies added a comment - Well, you always do if you agree that this is undesirable behavior . If your reply has been 'that's what we intended', I would have been happy not to have troubled with a test case.
        Hide
        Benson Margulies added a comment -

        I don't have time to chase this.

        Show
        Benson Margulies added a comment - I don't have time to chase this.
        Hide
        William Bakker added a comment -

        It seems the dependency exclusion is broken when the 'promoteTransitiveDependencies' parameter is set to true. First, all transitive dependencies are promoted. Then, maven only excludes the dependencies from artifacts you specified. However, the previous step introduced new dependencies on which the exclusions rules do not match.

        Example

        projectA depends on guava 16.0
        projectB depends on guava 17.0 and on projectA
        projectC depends on guava 18.0 and on projectB, but excludes guava.

        projectC-shaded shades projectC using promoteTransitiveDependencies

        projectD depends on guava 19.0 and projectC-shaded.

        This gives dependency tree:

        [INFO] mshade-86:projectD:jar:1.0-SNAPSHOT
        [INFO] +- mshade-86:projectC-shaded:jar:1.0-SNAPSHOT:compile
        [INFO] |  +- mshade-86:projectB:jar:1.0-SNAPSHOT:compile
        [INFO] |  |  +- (mshade-86:projectA:jar:1.0-SNAPSHOT:compile - omitted for duplicate)
        [INFO] |  |  \- (com.google.guava:guava:jar:17.0:compile - omitted for conflict with 18.0)
        [INFO] |  +- mshade-86:projectA:jar:1.0-SNAPSHOT:compile
        [INFO] |  |  \- (com.google.guava:guava:jar:16.0:compile - omitted for conflict with 17.0)
        [INFO] |  \- (com.google.guava:guava:jar:18.0:compile - omitted for conflict with 19.0)
        [INFO] \- com.google.guava:guava:jar:19.0:compile
        

        Gist

        A full reproduction scenario of this issue has been logged at https://gist.github.com/wjbakker/328a05382e466de7fef3e07fc664d44f

        Show
        William Bakker added a comment - It seems the dependency exclusion is broken when the 'promoteTransitiveDependencies' parameter is set to true. First, all transitive dependencies are promoted. Then, maven only excludes the dependencies from artifacts you specified. However, the previous step introduced new dependencies on which the exclusions rules do not match. Example projectA depends on guava 16.0 projectB depends on guava 17.0 and on projectA projectC depends on guava 18.0 and on projectB, but excludes guava. projectC-shaded shades projectC using promoteTransitiveDependencies projectD depends on guava 19.0 and projectC-shaded. This gives dependency tree: [INFO] mshade-86:projectD:jar:1.0-SNAPSHOT [INFO] +- mshade-86:projectC-shaded:jar:1.0-SNAPSHOT:compile [INFO] | +- mshade-86:projectB:jar:1.0-SNAPSHOT:compile [INFO] | | +- (mshade-86:projectA:jar:1.0-SNAPSHOT:compile - omitted for duplicate) [INFO] | | \- (com.google.guava:guava:jar:17.0:compile - omitted for conflict with 18.0) [INFO] | +- mshade-86:projectA:jar:1.0-SNAPSHOT:compile [INFO] | | \- (com.google.guava:guava:jar:16.0:compile - omitted for conflict with 17.0) [INFO] | \- (com.google.guava:guava:jar:18.0:compile - omitted for conflict with 19.0) [INFO] \- com.google.guava:guava:jar:19.0:compile Gist A full reproduction scenario of this issue has been logged at https://gist.github.com/wjbakker/328a05382e466de7fef3e07fc664d44f

          People

          • Assignee:
            Unassigned
            Reporter:
            Benson Margulies
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development