在 sbt 中,如何添加本地文件系统中的插件? [英] In sbt, how do you add a plugin that's in the local filesystem?

查看:28
本文介绍了在 sbt 中,如何添加本地文件系统中的插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我想在项目树之外的本地目录中添加一个插件,那么正确的方法是什么?假设我将诸如 https://github.com/steppenwells/sbt-sh.git 之类的简单内容克隆到/tmp/sbt-sh - 我在 build.sbt 文件中放什么来使用来自/tmp/sbt-sh 的插件,该插件将获取我在/tmp/sbt-sh 中所做的任何更改?

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/steppenwells/sbt-sh.git to /tmp/sbt-sh - what do I put in my build.sbt file to use the plugin from /tmp/sbt-sh that will pick up any changes I make in /tmp/sbt-sh?

推荐答案

project/project/Build.scala 中应该这样做:

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")
}

请注意,双重嵌套的 project 目录是必需的.我不知道有什么方法可以从 .sbt 文件中做到这一点(可能有一种方法,但我不知道它是什么).

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).

这被记录在这里(参见1d)项目依赖").

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

这篇关于在 sbt 中,如何添加本地文件系统中的插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆