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

左心房为你撑大大i 提交于 2020-01-03 13:30:10

问题


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

  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]].




回答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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!