问题
I am trying to use sbt-scalabuff plugin, but sbt keeps complaining that the plugin cannot be found.
The plugin documentation does not state out a resolver url, either. Is the plugin deprecated or my Scala version is not supported?
Details:
com.github.sbt:sbt-scalabuff:0.2 (sbtVersion=0.13, scalaVersion=2.10)
Here is my 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
回答1:
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
.
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).
It seems that your only options are to downgrade sbt to 0.12.4
or migrate the plugin to 0.13
.
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.
Use the following in project/sbt-scalabuff.sbt
:
addSbtPlugin("com.github.sbt" %% "sbt-scalabuff" % "0.2")
You should then specify the version of sbt in project/build.properties
as follows:
sbt.version=0.12.4
or just use sbt-launch 0.12.4.
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
See the scalabuff.ScalaBuffPlugin object in the GitHub repository.
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)
}
来源:https://stackoverflow.com/questions/20554613/how-to-use-sbt-scalabuff-plugin-with-sbt-0-13