sbt / sbt-dependency-graph

sbt plugin to create a dependency graph for your project
Apache License 2.0
1.25k stars 113 forks source link

dependencyTree only prints the module itself (no dependencies) #176

Open pmpfr opened 5 years ago

pmpfr commented 5 years ago

Under sbt 0.13.17; sbt-dependency-draph 0.9.2, a multi-module project:

> Common/dependencyTree
[info] com.ocado.cfc.vectortests:common_2.12:0ec6cb226ed46262f97474689f421a5a9a4f2305-SNAPSHOT-pmpfr-snyk
[success] Total time: 0 s, completed 07-Feb-2019 17:47:46

If run on the root project, it prints one line for each module and still thinks nothing depends on anything. If I downgrade to 0.8.2 it works fine.

Superficially similar to https://github.com/jrudolph/sbt-dependency-graph/issues/171 except the output is one line rather than no line and different sbt versions.

Tomorrow I may try to find a more minimal reproduction.

pmpfr commented 5 years ago

Getting a neat, reliable reproduction case is hard. Whether it works or not is not referentially transparent: it depends on the sequence of sbt commands with the same/different build config. But it appears to come down to setting: updateOptions := updateOptions.value.withCachedResolution(true)

(Possibly also interacting with dependencyOverrides += "io.netty" % "netty" % "3.9.2.Final" but I think the latter may be a red herring and just an example of "changing something which makes the build different" and I think enabling cached resolution alone is enough.)

justinpitts commented 5 years ago

I'm reproducing this.

sbt 0.13.18 plugin version 0.9.2

Confirming that cached resolution behaves the same for me.

Additionally, dependencyGraph yields:

java.util.NoSuchElementException: key not found: ModuleId(org.scala-sbt.temp,temp-resolve-e35e879ea6119130013c08ef868b3b683bb1a52c,1.0) at scala.collection.MapLike$class.default(MapLike.scala:228) at scala.collection.AbstractMap.default(Map.scala:58) at scala.collection.MapLike$class.apply(MapLike.scala:141) at scala.collection.AbstractMap.apply(Map.scala:58) at net.virtualvoid.sbt.graph.ModuleGraph.module(model.scala:51) at net.virtualvoid.sbt.graph.rendering.AsciiGraph$$anonfun$2.apply(AsciiGraph.scala:37) at net.virtualvoid.sbt.graph.rendering.AsciiGraph$$anonfun$2.apply(AsciiGraph.scala:37) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) at scala.collection.immutable.List.foreach(List.scala:318) at scala.collection.TraversableLike$class.map(TraversableLike.scala:244) at scala.collection.AbstractTraversable.map(Traversable.scala:105) at net.virtualvoid.sbt.graph.rendering.AsciiGraph$.buildAsciiGraph(AsciiGraph.scala:37) at net.virtualvoid.sbt.graph.rendering.AsciiGraph$.asciiGraph(AsciiGraph.scala:26) at net.virtualvoid.sbt.graph.rendering.AsciiGraph$$anonfun$asciiGraphSetttings$2$$anonfun$apply$1$$anonfun$apply$2$$anonfun$apply$3.apply(AsciiGraph.scala:47) at net.virtualvoid.sbt.graph.rendering.AsciiGraph$$anonfun$asciiGraphSetttings$2$$anonfun$apply$1$$anonfun$apply$2$$anonfun$apply$3.apply(AsciiGraph.scala:47) at sbt.MultiLogger.log(MultiLogger.scala:27) at sbt.Logger$class.info(Logger.scala:117) at sbt.AbstractLogger.info(Logger.scala:11) at net.virtualvoid.sbt.graph.rendering.AsciiGraph$$anonfun$asciiGraphSetttings$2$$anonfun$apply$1$$anonfun$apply$2.apply(AsciiGraph.scala:47) at net.virtualvoid.sbt.graph.rendering.AsciiGraph$$anonfun$asciiGraphSetttings$2$$anonfun$apply$1$$anonfun$apply$2.apply(AsciiGraph.scala:43) at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47) at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40) at sbt.std.Transform$$anon$4.work(System.scala:63) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228) at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17) at sbt.Execute.work(Execute.scala:237) at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228) at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228) at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159) at sbt.CompletionService$$anon$2.call(CompletionService.scala:28) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) [error] (compile:dependencyGraph) java.util.NoSuchElementException: key not found: ModuleId(org.scala-sbt.temp,temp-resolve-e35e879ea6119130013c08ef868b3b683bb1a52c,1.0)

hiber-niu commented 5 years ago

I also stuck in this situation.