Skip to content

dependencyTree loses track of dependency if it has <relocated> tag in POM #8400

@ane

Description

@ane

steps

With the following build.sbt and sbt 1.11.7

name := "sbt bug for dependencyTree"

libraryDependencies += "org.lz4" % "lz4-java" % "1.8.1"

problem

Calling show dependencyTree does not list the artifact, even though it is downloaded and present on the classpath:

sbt:sbt bug for dependencyTree> show dependencyTree
[info] Updating sbt-bug-for-dependencytree_2.12
https://repo1.maven.org/maven2/org/lz4/lz4-java/1.8.1/lz4-java-1.8.1.pom
  100,0% [##########] 530B (1,2 KiB / s)
[info] Resolved sbt-bug-for-dependencytree_2.12 dependencies
[info] Fetching artifacts of sbt-bug-for-dependencytree_2.12
[info] Fetched artifacts of sbt-bug-for-dependencytree_2.12
[info] sbt-bug-for-dependencytree:sbt-bug-for-dependencytree_2.12:0.1.0-SNAPSHOT [S]
[info] ()
[success] Total time: 1 s, completed 4 Dec 2025, 19.58.28

This is because the POM shows

<relocation>
<groupId>at.yawk.lz4</groupId>
</relocation>

On the other hand, if you use the relocated group id "at.yawk.lz4" % "lz4-java" % "1.8.1", it shows up:

sbt:sbt bug for dependencyTree> show dependencyTree
[info] sbt-bug-for-dependencytree:sbt-bug-for-dependencytree_2.12:0.1.0-SNAPSHOT [S]
[info]   +-at.yawk.lz4:lz4-java:1.8.1

Most likely the dependencyTree compares the source from build.sbt and filters out artifacts it doesn't see anymore, but this doesn't take relocation into consideration.

expectation

The relocated artifact should show in the dependency tree.

notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions