-
-
Save cvogt/02a2f5a90a45fca27f0707d32546e14e to your computer and use it in GitHub Desktop.
Enabling sbt plugins from the command line in any sbt project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% sbtx dependencyGraph | |
... blah blah ... | |
[info] *** Welcome to the sbt build definition for Scala! *** | |
[info] Check README.md for more information. | |
[error] Not a valid command: dependencyGraph | |
[error] Not a valid project ID: dependencyGraph | |
% sbtx -Dplugins=graph dependencyGraph | |
... blah blah ... | |
[info] +---------------+ | |
[info] | scalap | | |
[info] |org.scala-lang | | |
[info] |2.12.0-SNAPSHOT| | |
[info] +---------------+ | |
[info] | | |
[info] v | |
[info] +------------------+ | |
[info] |scala-compiler [S]| | |
[info] | org.scala-lang | | |
[info] | 2.12.0-SNAPSHOT | | |
[info] +------------------+ | |
[info] | | | | | |
[info] ------------------ | | -------------------------- | |
[info] | | | | | |
[info] v | | | | |
[info] +--------------+ | | | | |
[info] | ant | | | | | |
[info] |org.apache.ant| | | | | |
[info] | 1.9.4 | | | | | |
[info] +--------------+ | | | | |
[info] | ---------------- | | | |
[info] ------------- | | | | |
[info] | | | | | |
[info] v v v v | |
[info] +--------------+ +-----------------+ +----------------------+ +----------------------+ | |
[info] | ant-launcher | |scala-reflect [S]| | scala-asm | | scala-xml_2.12.0-M5 | | |
[info] |org.apache.ant| | org.scala-lang | |org.scala-lang.modules| |org.scala-lang.modules| | |
[info] | 1.9.4 | | 2.12.0-SNAPSHOT | | 5.1.0-scala-1 | | 1.0.5 | | |
[info] +--------------+ +-----------------+ +----------------------+ +----------------------+ | |
% sbtx -Dplugins=graph,coursier dependencyGraph | |
... blah blah ... | |
https://repo1.maven.org/maven2/com/typesafe/mima-reporter_2.10/0.1.8/mima-reporter_2.10-0.1.8.pom | |
100.0% [##########] 2.3 KiB (3.2 KiB / s) | |
https://repo1.maven.org/maven2/biz/aQute/bnd/biz.aQute.bnd/2.4.1/biz.aQute.bnd-2.4.1.pom | |
100.0% [##########] 1.5 KiB (1.7 KiB / s) | |
https://repo1.maven.org/maven2/org/pantsbuild/jarjar/1.6.3/jarjar-1.6.3.pom | |
100.0% [##########] 2.1 KiB (2.1 KiB / s) | |
https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.apache.ant/ant/1.9.6/ivys/ivy.xml.sha1 | |
[ ] 0 B (0 B / s) | |
https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.apache.ant/ant/1.9.6/ivys/ivy.xml | |
[ ] 0 B (0 B / s) | |
https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.scala-lang/scala-swing/2.10.6/ivys/ivy.x… | |
[ ] 0 B (0 B / s) | |
https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.scala-lang/scala-actors/2.10.6/ivys/ivy.… | |
[ ] 0 B (0 B / s) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This file is at $HOME/.sbt/0.13/plugins/plugins.sbt | |
lazy val isEnabled: Set[String] = sys.props.getOrElse("plugins", "").split(",").map(_.trim).toSet | |
def maybeEnable(pair: (String, ModuleID)): Seq[Setting[_]] = | |
if (isEnabled(pair._1)) addSbtPlugin(pair._2) else Seq() | |
Seq[(String, ModuleID)]( | |
"aether" -> "no.arktekk.sbt" % "aether-deploy" % "0.17", | |
"coursier" -> "io.get-coursier" % "sbt-coursier" % "1.0.0-M12", | |
"graph" -> "net.virtual-void" % "sbt-dependency-graph" % "0.8.2", | |
"impact" -> "com.updateimpact" % "updateimpact-sbt-plugin" % "2.1.1", | |
"jmh" -> "pl.project13.scala" % "sbt-jmh" % "0.2.10", | |
"pgp" -> "com.jsuereth" % "sbt-pgp" % "1.0.0", | |
"psp" -> "org.improving" % "sbt-psp" % "61521d8859be70ba566f5e776d6e68f06d062cec", | |
"scalafmt" -> "com.geirsson" %% "sbt-scalafmt" % "0.2.5", | |
"scoverage" -> "org.scoverage" % "sbt-scoverage" % "1.3.5", | |
"sonatype" -> "org.xerial.sbt" % "sbt-sonatype" % "1.1", | |
"unused" -> "com.hanhuy.sbt" % "sbt-unused" % "0.1", | |
"updates" -> "com.timushev.sbt" % "sbt-updates" % "0.2.0" | |
).flatMap(maybeEnable) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment