How to collect all the values for a SettingKey across all projects for use in an sbt plugin?

41 Views Asked by At

I am trying to collect the set of values for libraryDependencies across all projects/scopes/etc in an sbt 1.x build.

What is the right way to accomplish this?

1

There are 1 best solutions below

0
On

I came to the answer courtesy of @gpoirier in the Gitter sbt/sbt room:

val extracted = Project.extract(state.value)
import extracted._

val allLibraryDependencies = structure.allProjectRefs.flatMap({ p =>
  get(libraryDependencies in p)
}).distinct