Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SBT cannot append Seq[Object] to Seq[ModuleID]

Tags:

scala

sbt

SBT keeps failing with improper append errors. Im using the exact format of build files I have seen numerous times.

build.sbt:

lazy val backend = (project in file("backend")).settings(
name := "backend",
libraryDependencies ++= (Dependencies.backend)
).dependsOn(api).aggregate(api)

dependencies.scala:

import sbt._

object Dependencies {

lazy val backend = common ++ metrics

val common = Seq(
"com.typesafe.akka" %% "akka-actor" % Version.akka,
"com.typesafe.akka" %% "akka-cluster" % Version.akka,
"org.scalanlp.breeze" %% "breeze" % Version.breeze,
"com.typesafe.akka" %% "akka-contrib" % Version.akka,
"org.scalanlp.breeze-natives" % Version.breeze,
"com.google.guava" % "guava" % "17.0"
)

val metrics = Seq("org.fusesource" % "sigar" % "1.6.4")

Im Im not quite why SBT is complaining

error: No implicit for Append.Values[Seq[sbt.ModuleID], Seq[Object]] found,
so Seq[Object] cannot be appended to Seq[sbt.ModuleID]
libraryDependencies ++= (Dependencies.backend)
                    ^
like image 889
Azeli Avatar asked Mar 27 '15 22:03

Azeli


2 Answers

Short Version (TL;DR)

There's an error in common: you want to replace this line

"org.scalanlp.breeze-natives" % Version.breeze,

with this line

"org.scalanlp" %% "breeze-natives" % Version.beeze,

Long Version

  1. "org.scalanlp.breeze-natives" % Version.breeze is a GroupArtifactID not a ModuleID.

  2. This causes common to become a Seq[Object] instead of a Seq[ModuleID].

  3. And therefore also Dependencies.backend to be a Seq[Object]

  4. Which ultimately can't be appended (via ++=) to libraryDependencies (defined as a SettingKey[Seq[ModuleID]]) because there is no available Append.Values[Seq[sbt.ModuleID], Seq[Object]].

like image 183
Dale Wijnand Avatar answered Sep 30 '22 19:09

Dale Wijnand


One of common or metrics is not a Seq[sbt.ModuleID]. You could find out which with a type ascription:

val common: Seq[sbt.ModuleID] = ...
val metrics: Seq[sbt.ModuleID] = ...

My money is on common, this line doesn't have enough %s in it:

"org.scalanlp.breeze-natives" % Version.breeze
like image 28
Richard Close Avatar answered Sep 30 '22 18:09

Richard Close