问题
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)
^
回答1:
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
"org.scalanlp.breeze-natives" % Version.breeze
is aGroupArtifactID
not aModuleID
.This causes
common
to become aSeq[Object]
instead of aSeq[ModuleID]
.And therefore also
Dependencies.backend
to be aSeq[Object]
Which ultimately can't be appended (via
++=
) tolibraryDependencies
(defined as aSettingKey[Seq[ModuleID]]
) because there is no availableAppend.Values[Seq[sbt.ModuleID], Seq[Object]]
.
回答2:
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
来源:https://stackoverflow.com/questions/29311341/sbt-cannot-append-seqobject-to-seqmoduleid