1

Can someone give me a minimal working sbt setup for sbt-scalabuff? The information that's out there seems incomplete. I'm currently trying to use addSbtPlugin("com.github.sbt" % "sbt-scalabuff" % "0.2"), but I get sbt.ResolveException: unresolved dependency: net.sandrogrzicic#scalabuff-runtime_2.9.2;1.3.6: not found. I guess I'm missing a repository.

Why is it using 2.9.2, though? I have scalaVersion := 2.10.3.

build.sbt

organization := "com.confabulous"

name := "protobuf"

version := "0.0.1-SNAPSHOT"

scalaVersion := "2.10.4"

scalacOptions += "-deprecation"

resolvers ++= Seq(
  "sonatype releases"  at "https://oss.sonatype.org/content/repositories/releas
  "sonatype snapshots" at "https://oss.sonatype.org/content/repositories/snapsh
  "typesafe repo"      at "http://repo.typesafe.com/typesafe/releases/"
)

libraryDependencies += "net.sandrogrzicic" %% "scalabuff-runtime" % "1.3.6"

plugins/plugins.sbt

addSbtPlugin("com.github.sbt" % "sbt-scalabuff" % "0.2")

project/Build.scala

import sbt._
import scalabuff.ScalaBuffPlugin._

object build extends Build {
  lazy val root = Project("main", file("."), settings = Defaults.defaultSetting
}

Output

$ sbt compile
Loading /usr/share/sbt/bin/sbt-launch-lib.bash
[info] Loading project definition from /home/dan/projects/confabulous/protobuf/project
[info] Updating {file:/home/dan/projects/confabulous/protobuf/project/}default-6a3ff1...
[info] Resolving org.scala-sbt#precompiled-2_10_1;0.12.4 ...
[info] Done updating.
[info] Set current project to protobuf (in build file:/home/dan/projects/confabulous/protobuf/)
[info] Compiling 1 Scala source to /home/dan/projects/confabulous/protobuf/target/scala-2.10/classes...
[error] /home/dan/projects/confabulous/protobuf/target/scala-2.10/src_managed/scala/com/confabulous/protobuf/ConfabulousProtobuf.scala:11: not found: value net
[error]     with net.sandrogrzicic.scalabuff.Message[Pair] {
[error]          ^
[error] /home/dan/projects/confabulous/protobuf/target/scala-2.10/src_managed/scala/com/confabulous/protobuf/ConfabulousProtobuf.scala:76: not found: value net
[error]     with net.sandrogrzicic.scalabuff.Message[Notice] {
[error]          ^
Isvara
  • 3,403
  • 1
  • 28
  • 42
  • Okay, I deleted target, project/target and project/project, downgraded to sbt 0.12.4 and ran it again. Now I get no errors. But I also get no output file. – Isvara Apr 11 '14 at 17:52
  • possible duplicate of [How to use sbt-scalabuff plugin with sbt 0.13?](http://stackoverflow.com/questions/20554613/how-to-use-sbt-scalabuff-plugin-with-sbt-0-13) –  Apr 11 '14 at 18:38
  • If I use what's in that one, I can generate the `.scala` in `src_managed` with the `scalabuff` task (is that even mentioned in the docs?!), but when I compile it, I get the error above, even though I have `libraryDependencies += "net.sandrogrzicic" %% "scalabuff-runtime" % "1.3.6"`. – Isvara Apr 11 '14 at 19:16
  • In your project/build.properties did you specify that the sbt version should be 0.12.4? –  Apr 11 '14 at 19:52
  • Yes... I think that's the latest supported. – Isvara Apr 11 '14 at 22:40
  • OK, I got it working. See my post below as I can't put it in the comments area. –  Apr 12 '14 at 14:48
  • 1
    “Why is it using 2.9, though?” In sbt 0.12, that's the Scala version build definitions and plugins use — regardless of the `scalaVersion` setting. That setting applies to the code _being built_. In sbt 0.13, build definitions and plugins use Scala 2.10. – Seth Tisue Apr 12 '14 at 15:22
  • I'm having the same error. Where you able to solve it? – Incerteza Jan 23 '15 at 16:59
  • I have the same errors, also i have no output file even by using ScalaBuff compiler(1.4.0) directly(not as sbt-scalabuff plugin). Could somebody explain the reason ? Maybe the problem is that I am using jdk8 ? – hellraiser Apr 13 '15 at 05:20

1 Answers1

0

Add https://dl.bintray.com/actor/maven to your SBT resolver

resolvers ++= Seq("sonatype releases"  at "https://oss.sonatype.org/content/repositories/releas
"sonatype snapshots" at "https://oss.sonatype.org/content/repositories/snapsh
"typesafe repo"      at "http://repo.typesafe.com/typesafe/releases/"
"bintrayRepo" at "https://dl.bintray.com/actor/maven"
)
Prasad
  • 616
  • 7
  • 11