In sbt, how do you add a plugin that's in the local filesystem?

前端 未结 2 390
广开言路
广开言路 2020-12-24 07:29

If I want to add a plugin that\'s in a local directory outside the project tree, what\'s the right way to do that? Say I clone something simple like https://github.com/step

相关标签:
2条回答
  • 2020-12-24 07:37

    In 0.13, there's a) a simple way to do this, and b) better documentation. @PaulButcher's answer pointed to section 1d of the sbt documentation for plugins, which now tells you to edit project/plugins.sbt:

    (@axel22 points out this has changed, so check the current doc before you copy this)

    lazy val root = project.in( file(".") ).dependsOn( assemblyPlugin )
    lazy val assemblyPlugin = uri("git://github.com/sbt/sbt-assembly#0.9.1")
    

    And of course that uri(... can be replaced with a file("/tmp/sbt-sh").

    0 讨论(0)
  • 2020-12-24 07:54

    Something like this in project/project/Build.scala should do it:

    import sbt._
    object PluginDef extends Build {
        lazy val projects = Seq(root)
        lazy val root = Project("plugins", file(".")) dependsOn( shPlugin )
        lazy val shPlugin = uri("file:///tmp/sbt-sh")
    }
    

    Note that that the doubly-nested project directories are required. I'm not aware of any way to do this from an .sbt file (there may be a way, but I don't know what it is).

    This is documented here (see "1d) Project dependency").

    0 讨论(0)
提交回复
热议问题