Skip to content

Instantly share code, notes, and snippets.

@EdgeCaseBerg
Created January 25, 2016 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EdgeCaseBerg/928a6a3e09e030ad7f3d to your computer and use it in GitHub Desktop.
Save EdgeCaseBerg/928a6a3e09e030ad7f3d to your computer and use it in GitHub Desktop.
sbt build task to see dependencies in a project.
//https://groups.google.com/forum/#!topic/simple-build-tool/rcPh-lWbDtk
lazy val versionReport = TaskKey[String]("version-report")
// Add this setting to your project.
versionReport <<= (externalDependencyClasspath in Compile, streams) map {
(cp: Seq[Attributed[File]], streams) =>
val report = cp.map {
attributed =>
attributed.get(Keys.moduleID.key) match {
case Some(moduleId) => "%40s %20s %10s %10s".format(
moduleId.organization,
moduleId.name,
moduleId.revision,
moduleId.configurations.getOrElse("")
)
case None =>
// unmanaged JAR, just
attributed.data.getAbsolutePath
}
}.mkString("\n")
streams.log.info(report)
report
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment