Scalapb: Unresolved Dependency - Documentation Issue

Created on 27 Jun 2016  路  13Comments  路  Source: scalapb/ScalaPB

I was trying to use ScalaPB via the standard SBT project as mentioned on the official website. My sbt version is 0.13.11. I am getting a an error as follows :

[error] (*:update) sbt.ResolveException: unresolved dependency: com.trueaccord.scalapb#sbt-scalapb;0.4.20: not found
[error] Total time: 14 s, completed 27 Jun, 2016 3:47:37 AM

All 13 comments

Does it print which URLs it is looking for it?

Hi, I met the same error while trying to add dependency, the complete message as follows:

Error:Error while importing SBT project:
...

[info] Resolving com.typesafe.play#twirl-parser_2.10;1.1.1 ...
[info] Resolving org.scala-sbt#ivy;0.13.11 ...
[info] Resolving org.scala-lang#scala-reflect;2.11.6 ...
[info] Resolving io.apigee#rhino;1.7R5pre4 ...
[info] Resolving org.scala-sbt#test-interface;1.0 ...
[info] Resolving com.typesafe#config;1.3.0 ...
[info] Resolving org.scala-sbt#logging;0.13.11 ...
[info] Resolving org.scala-sbt#tracking;0.13.11 ...
[info] Resolving javax.inject#javax.inject;1 ...
[info] Resolving com.typesafe.akka#akka-persistence-experimental_2.10;2.3.11 ...
[info] Resolving org.apache.maven#maven-core;3.2.2 ...
[info] Resolving com.fasterxml.jackson.core#jackson-databind;2.3.3 ...
[info] Resolving org.scala-sbt#control;0.13.11 ...
[info] Resolving org.apache.maven#maven-repository-metadata;3.2.2 ...
[info] Resolving org.bouncycastle#bcpg-jdk15on;1.51 ...
[trace] Stack trace suppressed: run 'last *:update' for the full output.
[trace] Stack trace suppressed: run 'last *:ssExtractDependencies' for the full output.
error sbt.ResolveException: unresolved dependency: com.trueaccord.scalapb#scalapb_2.11;0.4.20: not found
error sbt.ResolveException: unresolved dependency: com.trueaccord.scalapb#scalapb_2.11;0.4.20: not found
[error] Total time: 34 s, completed Jun 27, 2016 1:40:28 PM

See complete log in /Users/kd/Library/Logs/IntelliJIdea2016.1/sbt.last.log

Look forward to your reply, thanks.

Can you post a full project? I am unable to reproduce this issue.

Since the full project is large and local, not so convenient to post, I list the configuration files as follows.

In scalapb.sbt:

libraryDependencies ++= Seq(
"com.trueaccord.scalapb" %% "compilerplugin" % "0.4.20",
"com.github.os72" % "protoc-jar" % "3.0.0-b2.1"
)

In build.properties:

Activator-generated Properties

Wed Jul 22 13:20:51 CST 2015

template.uuid=a91771f5-1745-4f51-b877-badeea610f64
sbt.version=0.13.11

I haven't add the following statements to build.sbt yet:

import com.trueaccord.scalapb.{ScalaPbPlugin => PB}

PB.protobufSettings

Btw, the following dependency works:

"com.trueaccord.scalapb" %% "compilerplugin" % "0.4.20"

If anything else I could supply, just tell me.
Thanks.

Do you have the following line in your project/scalapb.sbt:

addSbtPlugin("com.trueaccord.scalapb" % "sbt-scalapb" % "0.4.20")

Oh, totally my mistake. I placed scalapb.sbt in wrong path.
And under your guidance it works now!
Very grateful for your timely help!
Thanks!

@PeeyushAgg can you post an example project with this behavior?

build.sbt

name := "Service-1"

organization := "com.betaout"

version := "1.0"

scalaVersion := "2.11.8"

scalacOptions := Seq("-unchecked", "-deprecation", "-encoding", "utf8")


resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"

libraryDependencies ++= {
  val akkaV       = "2.4.7"
  Seq(
    "com.typesafe.akka" %% "akka-actor" % akkaV,
    "com.typesafe.akka" %% "akka-stream" % akkaV,
    "com.typesafe.akka" %% "akka-agent" % akkaV,
    "com.typesafe.akka" %% "akka-remote" % akkaV,
    "com.typesafe.akka" %% "akka-slf4j"      % "2.3.9",
    "org.reactivemongo" %% "reactivemongo" % "0.10.5.0.akka23",
    "org.reactivemongo" %% "play2-reactivemongo" % "0.10.5.0.akka23",
    "com.typesafe.play" % "play-json_2.11" % "2.4.0-M2",
    "org.json4s" %% "json4s-jackson" % "3.2.11"
  )
}

import com.trueaccord.scalapb.{ScalaPbPlugin => PB}

PB.protobufSettings

PB.runProtoc in PB.protobufConfig := (args =>
  com.github.os72.protocjar.Protoc.runProtoc("-v241" +: args.toArray))

libraryDependencies ++= Seq(
    "io.grpc" % "grpc-netty" % "0.14.0",
    "com.trueaccord.scalapb" %% "scalapb-runtime-grpc" % (PB.scalapbVersion in PB.protobufConfig).value
)

build.properties

sbt.version=0.13.11

scalapb.sbt

addSbtPlugin("com.trueaccord.scalapb" % "sbt-scalapb" % "0.5.26")

libraryDependencies ++= Seq(
  "com.trueaccord.scalapb" %% "compilerplugin" % "0.5.26",
  "com.github.os72" % "protoc-jar" % "3.0.0-b2.1"
)

I set up a project with the files you provided and ScalaPB loads correctly.

@PeeyushAgg , when SBT is unable to resolve a dependency it prints a few lines that says where it's looking for it. Here is what it might look like:

[warn]  module not found: x#y;0.1.4
[warn] ==== typesafe-ivy-releases: tried
[warn]   https://repo.typesafe.com/typesafe/ivy-releases/...
[warn] ==== sbt-plugin-releases: tried
[warn]   https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/...
[warn] ==== local: tried
[warn]   /home/thesamet/.ivy2/local/...
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/com/...

Most likely somewhere in your environment (maybe in ~/.sbt, or in another sbt file) you have a resolver := ... such that maven central is excluded. All versions of sbt-scalapb are there: https://repo1.maven.org/maven2/com/trueaccord/scalapb/sbt-scalapb_2.10_0.13/

This one helped. Issue resolved.

According to the doc added

addSbtPlugin("com.thesamet" % "sbt-protoc" % "0.99.1")

libraryDependencies += "com.trueaccord.scalapb" %% "compilerplugin" % "0.5.43"

to scalapb.sbt, added

PB.targets in Compile := Seq(
  scalapb.gen() -> (sourceManaged in Compile).value
)

to build.sbt. On sbt update I got unresolved dependency: com.trueaccord.scalapb#scalapb-runtime_2.12;0.5.43
What am I doing wrong?

We're supporting Scala 2.12 starting from version 0.5.45 (just change the compilerplugin version)

@thesamet thanks, it would be good to refelect this on the mentioned doc site

Was this page helpful?
0 / 5 - 0 ratings