我尝试使用 sbt-osgi 插件,但无法加载它AutoPlugin
,编译器拒绝编译我的代码。
首先,我将最新版本的插件添加到project/plugins.sbt
:
resolvers += Classpaths.sbtPluginSnapshots
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.8.0-SNAPSHOT")
之后,我将 sbt 版本设置为project/build.properties
:
sbt.version=0.13.7
然后,我创建project/Build.scala
了以下内容:
import sbt._
import com.typesafe.sbt.osgi.SbtOsgi
object Build extends sbt.Build {
lazy val fooProject = Project("foo-project", file("."))
.enablePlugins(SbtOsgi)
}
但这会导致以下错误消息:
[info] Loading project definition from .../sbt-osgi-test/project
[info] Compiling 1 Scala source to .../sbt-osgi-test/project/target/scala-2.10/sbt-0.13/classes...
[error] .../sbt-osgi-test/project/Build.scala:10: type mismatch;
[error] found : com.typesafe.sbt.osgi.SbtOsgi.type
[error] required: sbt.Plugins
[error] .enablePlugins(SbtOsgi)
[error] ^
[error] one error found
[error] (compile:compile) Compilation failed
此错误消息没有任何意义,因为AutoPlugin
extends sbt.Plugins
。可能是什么问题呢?