Skip to content

maven resolver plugin pulls excluded transitive dependencies #2109

@chasebradford

Description

@chasebradford

chase:lib1:1.0-SNAPSHOT

<dependencies>
</dependencies>

chase:lib2:1.0-SNAPSHOT:

<dependencies>
  <dependency>
    <groupId>chase</groupId>
    <artifactId>lib1</artifactId>
    <version>1.0-SNAPSHOT</version>
  </dependency>
</dependencies>

top:

<dependencies>
  <dependency>
    <groupId>chase</groupId>
    <artifactId>lib2</artifactId>
    <version>1.0-SNAPSHOT</version>
    <exclusions>
      <exclusion>
        <groupId>chase</groupId>
        <artifactId>lib1</artifactId>
      </exclusion>
    </exclusions>
  </dependency>
</dependencies>

My test SBT project depends on top.

// build.sbt
resolvers += "Local Maven Repository" at "file://" + Path.userHome.absolutePath + "/.m2/repository"

libraryDependencies += "chase" % "top" % "1.0-SNAPSHOT"

lib1 still resolves when I run sbt update, even though it's a transitive dependency and should be excluded. I hacked the SbtArtifactDescriptorReader in the sbt-maven-resolver to System.err.println(dependency.getArtifactId() + " EXCLUDES " + exclusion.getArtifactId()); and I can see that the exclusion rule is detected while processing top's dependencies. For some reason it still shows up in the full dependency tree:

#[Jul 15 14:44:30][~/TestProject]
> sbt dependencyTree
[info] Loading project definition from /Users/cbradford/TestProject/project
[info] Set current project to testproject (in build file:/Users/cbradford/TestProject/)
[info] Updating {file:/Users/cbradford/TestProject/}testproject...
[info] Resolving chase#top;1.0-SNAPSHOT ...
lib2 EXCLUDES lib1
[info] Resolving chase#lib2;1.0-SNAPSHOT ...
[info] Resolving chase#lib1;1.0-SNAPSHOT ...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] default:testproject_2.10:0.1-SNAPSHOT [S]
[info]   +-chase:top:1.0-SNAPSHOT
[info]     +-chase:lib2:1.0-SNAPSHOT
[info]       +-chase:lib1:1.0-SNAPSHOT

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions