如何在 sbt 0.13 中使用 sbt-scalabuff 插件? [英] How to use sbt-scalabuff plugin with sbt 0.13?
问题描述
我正在尝试使用 sbt-scalabuff 插件,但 sbt 一直抱怨该插件不能被发现.
I am trying to use sbt-scalabuff plugin, but sbt keeps complaining that the plugin cannot be found.
插件文档也没有说明解析器 url.插件是否已弃用或我的 Scala 版本不受支持?
The plugin documentation does not state out a resolver url, either. Is the plugin deprecated or my Scala version is not supported?
详情:
com.github.sbt:sbt-scalabuff:0.2 (sbtVersion=0.13, scalaVersion=2.10)
这是我的plugins.sbt
:
libraryDependencies += "net.sandrogrzicic" %% "scalabuff-runtime" % "1.3.6"
addSbtPlugin("com.github.sbt" %% "sbt-scalabuff" % "0.2")
这是堆栈跟踪的一部分:
Here is part of the stack trace:
sbt.ResolveException: unresolved dependency: com.github.sbt#sbt-scalabuff;0.2: not found
at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:213)
at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:122)
at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:121)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:116)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:116)
at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:104)
at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:51)
at sbt.IvySbt$$anon$3.call(Ivy.scala:60)
...
[error] (*:update) sbt.ResolveException: unresolved dependency: com.github.sbt#sbt-scalabuff;0.2: not found
推荐答案
sbt-scalabuff 插件没有发布到任何已知存储库的插件 jar 可用于您的配置 - sbtVersion=0.13
和 scalaVersion=2.10
.
The sbt-scalabuff plugin does not have the plugin jar published to any known repository sbt could use for your configuration - sbtVersion=0.13
and scalaVersion=2.10
.
我也怀疑该插件是否支持 sbt 0.13
(当我自己编译插件以使用该版本时,我的几次尝试都失败了).
I also doubt the plugin supports sbt 0.13
(few attempts of mine failed miserably when I compiled the plugin myself to use the version).
看来您唯一的选择是将 sbt 降级到 0.12.4
或将插件迁移到 0.13
.
It seems that your only options are to downgrade sbt to 0.12.4
or migrate the plugin to 0.13
.
由于插件已发布到 Resolver.sbtPluginRepo("releases")
存储库,即 http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases 作为 http://dl.bintray.com/sbt/sbt-plugin-releases/com.github.sbt/sbt-scalabuff/scala_2.10/sbt_0.12/ 你必须使用sbt的版本.
Since the plugin has been published to the Resolver.sbtPluginRepo("releases")
repository, i.e. http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases as http://dl.bintray.com/sbt/sbt-plugin-releases/com.github.sbt/sbt-scalabuff/scala_2.10/sbt_0.12/ you will have to use the version of sbt.
在project/sbt-scalabuff.sbt
中使用以下内容:
addSbtPlugin("com.github.sbt" %% "sbt-scalabuff" % "0.2")
然后你应该在 project/build.properties
中指定 sbt 的版本,如下所示:
You should then specify the version of sbt in project/build.properties
as follows:
sbt.version=0.12.4
或者只是使用 sbt-启动 0.12.4.
在 sbt 控制台中,您可以使用 scalabuff
任务或设置:scalabuff-version
、scalabuff-main
和 scalabuff-args
.
When in sbt console, you can use the scalabuff
task or the settings: scalabuff-version
, scalabuff-main
and scalabuff-args
.
> sbt-version
[info] 0.12.4
> about
[info] This is sbt 0.12.4
[info] The current project is {file:/Users/jacek/sandbox/sbt-scalabuff-test-project/}main
[info] The current project is built against Scala 2.9.2
[info] Available Plugins: org.sbtidea.SbtIdeaPlugin, com.timushev.sbt.updates.UpdatesPlugin, scalabuff.ScalaBuffPlugin
[info] sbt, sbt plugins, and build definitions are using Scala 2.9.2
> scalabuff-version
[info] 1.1.1
> help scalabuff
Generate Scala sources from protocol buffers definitions
> scalabuff-args
[info] List()
> scalabuff-main
[info] net.sandrogrzicic.scalabuff.compiler.ScalaBuff
请参阅 GitHub 中的 scalabuff.ScalaBuffPlugin 对象存储库.
See the scalabuff.ScalaBuffPlugin object in the GitHub repository.
我还必须更改构建对象(如使用部分中所述)以设置项目使用插件import sbt._
:
I also had to change the build object (as described in the Usage section) to set up a project with the plugin to import sbt._
:
import sbt._
import scalabuff.ScalaBuffPlugin._
object build extends Build {
lazy val root = Project(
"main",
file("."),
settings = Defaults.defaultSettings ++ scalabuffSettings
).configs(ScalaBuff)
}
这篇关于如何在 sbt 0.13 中使用 sbt-scalabuff 插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!