Skip to content

Sbt dependencyTree mangles output for multi-project build #6905

@meghfossa

Description

@meghfossa

Overview

sbt dependencyTree command produces junk output for multi-project builds.

Steps

  1. Output of sbt about
➜  multi git:(main) ✗ sbt about
[info] welcome to sbt 1.5.5 (Temurin Java 1.8.0_312)
[info] loading settings for project multi-build from plugins.sbt ...
[info] loading project definition from /Users/someuser/Work/upstream/example-projects/scala/multi/project
[info] loading settings for project global from build.sbt ...
[info] set current project to sbt-project-example (in build file:/Users/someuser/Work/upstream/example-projects/scala/multi/)
[info] This is sbt 1.5.5
[info] The current project is ProjectRef(uri("file:/Users/someuser/Work/upstream/example-projects/scala/multi/"), "global") 0.1.0-SNAPSHOT
[info] The current project is built against Scala 3.1.0
[info] Available Plugins
[info]  - sbt.ScriptedPlugin
[info]  - sbt.plugins.CorePlugin
[info]  - sbt.plugins.Giter8TemplatePlugin
[info]  - sbt.plugins.IvyPlugin
[info]  - sbt.plugins.JUnitXmlReportPlugin
[info]  - sbt.plugins.JvmPlugin
[info]  - sbt.plugins.MiniDependencyTreePlugin
[info]  - sbt.plugins.SbtPlugin
[info]  - sbt.plugins.SemanticdbPlugin
[info] sbt, sbt plugins, and build definitions are using Scala 2.12.14

Problem

When working against multi-project builds, sbt dependencyTree command produces mangled and incorrect graph.

For example, running sbt dependencyTree once (note each sub project competing to write to console?, graph is completely not readable)

➜  multi git:(main) ✗ sbt dependencyTree                                               
[info] welcome to sbt 1.5.5 (Temurin Java 1.8.0_312)
[info] loading settings for project multi-build from plugins.sbt ...
[info] loading project definition from /Users/someuser/Work/upstream/example-projects/scala/multi/project
[info] loading settings for project global from build.sbt ...
[info] set current project to sbt-project-example (in build file:/Users/someuser/Work/upstream/example-projects/scala/multi/)
[info] sub2:sub2_3:0.1.0-SNAPSHOT
[info] sub1:sub1_3:0.1.0-SNAPSHOT
[info]   +-com.typesafe.akka:akka-stream_3:2.6.19
[info] sbt-project-example:sbt-project-example_3:0.1.0-SNAPSHOT
[info]   | +-com.typesafe.akka:akka-actor_3:2.6.19
[info]   +-ch.qos.logback:logback-classic:1.2.11
[info]   | | +-com.typesafe:config:1.4.2
[info]   +-com.typesafe.akka:akka-stream_3:2.6.18
[info]   | | +-org.scala-lang.modules:scala-java8-compat_3:1.0.0
[info]   | | | +-org.scala-lang:scala3-library_3:3.0.0 (evicted by: 3.1.1)
[info]   | | | +-org.scala-lang:scala3-library_3:3.1.1
[info]   | +-ch.qos.logback:logback-core:1.2.11
[info]   | +-org.slf4j:slf4j-api:1.7.32
[info]   | 
[info]   | | | 
[info]   | +-com.typesafe.akka:akka-actor_3:2.6.18
[info]   | | +-com.typesafe:config:1.4.0
[info]   | | +-org.scala-lang.modules:scala-java8-compat_2.13:1.0.0 [S]
[info]   | | +-org.scala-lang:scala3-library_3:3.1.1
[info]   +-net.sourceforge.htmlcleaner:htmlcleaner:2.4
[info]   | | 
[info]   | | +-org.scala-lang:scala3-library_3:3.1.1-RC1
[info]   | +-com.typesafe.akka:akka-protobuf-v3_3:2.6.19
[info]   | +-com.typesafe:ssl-config-core_2.13:0.4.3 [S]
[info]   | | +-com.typesafe:config:1.4.0 (evicted by: 1.4.2)
[info]   | | +-com.typesafe:config:1.4.2
[info]   | | +-org.scala-lang.modules:scala-parser-combinators_2.13:1.1.2 [S]
[info]   | | 
[info]   | +-org.reactivestreams:reactive-streams:1.0.3
[info]   | +-org.jdom:jdom2:2.0.4
[info]   | +-org.scala-lang:scala3-library_3:3.1.1
[info]   | | 
[info]   | 
[info]   +-net.logstash.logback:logstash-logback-encoder:7.2
[info]   | 
[info]   | +-com.fasterxml.jackson.core:jackson-databind:2.13.3
[info]   | +-com.typesafe.akka:akka-protobuf-v3_3:2.6.18
[info]   | +-com.typesafe:ssl-config-core_2.13:0.4.2 [S]
[info]   |   +-com.fasterxml.jackson.core:jackson-annotations:2.13.3
[info]   +-org.scala-lang:scala3-library_3:3.1.0 [S]
[info]   |   +-com.fasterxml.jackson.core:jackson-core:2.13.3
[info]   | | +-com.typesafe:config:1.4.0
[info]   |   
[info]   +-org.scala-lang:scala3-library_3:3.1.1
[info]   
[info]   
[info]   | | +-org.scala-lang.modules:scala-parser-combinators_2.13:1.1.2 [S]
[info]   | | 
[info]   | +-org.reactivestreams:reactive-streams:1.0.3
[info]   | +-org.scala-lang:scala3-library_3:3.1.1-RC1
[info]   | 
[info]   +-org.scala-lang:scala3-library_3:3.1.1-RC1
[info]   
[success] Total time: 0 s, completed 25-May-2022 7:02:45 PM

Running this same command again - produces different result:

➜  multi git:(main) ✗ sbt dependencyTree         
[info] welcome to sbt 1.5.5 (Temurin Java 1.8.0_312)
[info] loading settings for project multi-build from plugins.sbt ...
[info] loading project definition from /Users/someuser/Work/upstream/example-projects/scala/multi/project
[info] loading settings for project global from build.sbt ...
[info] set current project to sbt-project-example (in build file:/Users/someuser/Work/upstream/example-projects/scala/multi/)
[info] sbt-project-example:sbt-project-example_3:0.1.0-SNAPSHOT
[info]   +-com.typesafe.akka:akka-stream_3:2.6.18
[info] sub1:sub1_3:0.1.0-SNAPSHOT
[info] sub2:sub2_3:0.1.0-SNAPSHOT
[info]   +-com.typesafe.akka:akka-stream_3:2.6.19
[info]   | +-com.typesafe.akka:akka-actor_3:2.6.18
[info]   | +-com.typesafe.akka:akka-actor_3:2.6.19
[info]   +-ch.qos.logback:logback-classic:1.2.11
[info]   | | +-com.typesafe:config:1.4.2
[info]   | | +-org.scala-lang.modules:scala-java8-compat_3:1.0.0
[info]   | | +-com.typesafe:config:1.4.0
[info]   | | | +-org.scala-lang:scala3-library_3:3.0.0 (evicted by: 3.1.1)
[info]   | +-ch.qos.logback:logback-core:1.2.11
[info]   | | | +-org.scala-lang:scala3-library_3:3.1.1
[info]   | | +-org.scala-lang.modules:scala-java8-compat_2.13:1.0.0 [S]
[info]   | | | 
[info]   | +-org.slf4j:slf4j-api:1.7.32
[info]   | | +-org.scala-lang:scala3-library_3:3.1.1
[info]   | | +-org.scala-lang:scala3-library_3:3.1.1-RC1
[info]   | | 
[info]   | 
[info]   | +-com.typesafe.akka:akka-protobuf-v3_3:2.6.19
[info]   | | 
[info]   | +-com.typesafe:ssl-config-core_2.13:0.4.3 [S]
[info]   +-net.sourceforge.htmlcleaner:htmlcleaner:2.4
[info]   | | +-com.typesafe:config:1.4.0 (evicted by: 1.4.2)
[info]   | +-com.typesafe.akka:akka-protobuf-v3_3:2.6.18
[info]   | | +-com.typesafe:config:1.4.2
[info]   | +-org.jdom:jdom2:2.0.4
[info]   | | +-org.scala-lang.modules:scala-parser-combinators_2.13:1.1.2 [S]
[info]   | +-com.typesafe:ssl-config-core_2.13:0.4.2 [S]
[info]   | | +-com.typesafe:config:1.4.0
[info]   | | 
[info]   | 
[info]   | +-org.reactivestreams:reactive-streams:1.0.3
[info]   | | +-org.scala-lang.modules:scala-parser-combinators_2.13:1.1.2 [S]
[info]   | +-org.scala-lang:scala3-library_3:3.1.1
[info]   +-org.scala-lang:scala3-library_3:3.1.0 [S]
[info]   | 
[info]   +-net.logstash.logback:logstash-logback-encoder:7.2
[info]   | | 
[info]   | +-com.fasterxml.jackson.core:jackson-databind:2.13.3
[info]   
[info]   |   +-com.fasterxml.jackson.core:jackson-annotations:2.13.3
[info]   | +-org.reactivestreams:reactive-streams:1.0.3
[info]   |   +-com.fasterxml.jackson.core:jackson-core:2.13.3
[info]   | +-org.scala-lang:scala3-library_3:3.1.1-RC1
[info]   |   
[info]   | 
[info]   +-org.scala-lang:scala3-library_3:3.1.1
[info]   +-org.scala-lang:scala3-library_3:3.1.1-RC1
[info]   
[info]   
[success] Total time: 0 s, completed 25-May-2022 7:09:14 PM
  • Note how both outputs are different
  • Note how both output are incomprehensible (and not trustworthy from the output inconsistency)

I have not been able to produce the corrupted result in a single project build.

Expectation

When dependencyTree command is ran for multi-project build, it should produce consistent output ALL the time. Unfortunately, I can't produce dependencyTree output that is consistent or correct.

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