我知道sbt里有scalacOptions。但是通过addCompilerPlugin添加的选项在scalacOptions中并不存在。
我在sbt控制台中键入show scalacOptions,没有任何东西像-Xplugin那样。
那么,当我编写sbt插件时,如何才能获得real扩展选项呢?
我的sbt信息
> libraryDependencies
[info] List(org.scala-lang:scala-library:2.10.4, org.scala-lang:scala-reflect:2.10.4, io.netty:netty:3.9.0.Final, net.sandrogrzicic:scalabuff-runtime:1.3.7, org.scalamacros:quasiquotes:2.0.0, org.specs2:specs2:2.3.11:test, org.scalamacros:paradise:2.0.0:plugin->default(compile))
> show scalacOptions
[info] List(-feature, -deprecation, -language:implicitConversions, -language:dynamics)
[success] Total time: 0 s, completed Jul 3, 2014 4:04:09 PM
> version
[info] 0.0.1-SNAPSHOT
> sbt
sbtBinaryVersion sbtClearOnFailure sbtDependency sbtPlugin sbtPopOnFailure sbtResolver sbtStashOnFailure
> sbtVersion
[info] 0.13.5
> 我的build.sbt
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % "2.10.4",
"io.netty" % "netty" % "3.9.0.Final",
"net.sandrogrzicic" %% "scalabuff-runtime" % "1.3.7",
"org.scalamacros" %% "quasiquotes" % "2.0.0",
"org.specs2" %% "specs2" % "2.3.11" % "test")
scalacOptions ++= Seq(
"-feature",
"-deprecation",
"-language:implicitConversions",
"-language:dynamics"
)
parallelExecution in Test := false
addCompilerPlugin("org.scalamacros" % "paradise" % "2.0.0" cross CrossVersion.full)发布于 2014-07-03 09:47:12
最后,我发现compile:scalacOptions实际上包含插件设置
发布于 2014-07-03 08:02:05
您确定您确实成功地添加了编译器插件吗?
使用SBT0.13.5和build.sbt中的空项目:
addCompilerPlugin("org.scala-lang.plugins" % "continuations" % "2.10.1")我在libraryDependencies和scalacOptions中都有插件:
> libraryDependencies
[info] List(org.scala-lang:scala-library:2.10.4, org.scala-lang.plugins:continuations:2.10.1:plugin->default(compile))
> show scalacOptions
[info] List(-Xplugin:/Users/johan/.ivy2/cache/org.scala-lang.plugins/continuations/jars/continuations-2.10.1.jar)https://stackoverflow.com/questions/24544300
复制相似问题