如何安装sbt-sh插件

时间:2016-03-16 12:33:18

标签: scala plugins sbt

https://github.com/steppenwells/sbt-sh

我正在使用sbt 0.13.9并尝试使用给定的指令安装sbt-sh。但是sbt无法识别sh命令:

> sh ls
[error] Expected ID character
[error] Not a valid command: sh
[error] Expected 'show'
[error] Expected project ID
[error] Expected configuration
[error] Expected ':' (if selecting a configuration)
[error] Expected key
[error] Not a valid key: sh
[error] sh ls
[error]   ^
>

说明是针对sbt 0.10的,可能自那时起事情发生了变化,本指南已经过时了?

1 个答案:

答案 0 :(得分:0)

说明有点过时了。您应该将MyPlugins对象放在~/.sbt/plugins/project

中,而不是~/.sbt/0.13/plugins/project/MyPlugins.scala

然而,sbt-sh似乎不起作用,即使有了这样的修正:

[error] $HOME/.sbt/0.13/staging/1375c2d4ab8153e18523/sbt-sh/src/main/scala/org/sbtsh/SbtShPlugin.scala:4: object CommandSupport is not a member of package sbt
[error] import sbt.CommandSupport._
[error]            ^
[error] one error found
[error] ({git://github.com/steppenwells/sbt-sh.git}sbt-sh/compile:compileIncremental) Compilation failed

您可以试试xsbt-sh吗?

使用以下内容创建文件~/.sbt/0.13/plugins/xsbt-sh.sbt

resolvers += "Element Releases" at "http://repo.element.hr/nexus/content/repositories/releases/"

addSbtPlugin("hr.element.xsbt" % "xsbt-sh" % "0.0.2")

Github README指的是0.1.0,但似乎还没有发布到存储库。