具有多行的libraryDependencies

问题描述 投票:1回答:1

我正在尝试了解build.sbt文件。我想更好地组织我的build.sbt文件,并在每行添加一个依赖项。

我阅读了文档,并说我需要使用关键字Seq,并且格式类似于此:

libraryDependencies ++= Seq(
  groupID % artifactID % revision,
  groupID % otherID % otherRevision
)

并且我以为我理解了文档,但是显然不是因为当我尝试以这种方式添加多个依赖项时:

libraryDependencies ++= Seq(
    "org.typelevel",
    "cats-core" % "2.0.0",
    "org.scala-lang.modules",
    "scala-parser-combinators" % "1.1.2"
)

我收到以下错误:

build.sbt:26: error: No Append.Values[Seq[sbt.librarymanagement.ModuleID], Seq[Object]] found, so Seq[Object] cannot be appended to Seq[sbt.librarymanagement.ModuleID]
libraryDependencies ++= Seq(
                    ^
[error] Type error in expression

所以我不确定自己在做什么错,经过无休止的谷歌搜索之后,我找不到其中包含多行的build.sbt示例。

scala sbt
1个回答
0
投票

我发现了错误,并且我以错误的方式构造了buildDependencies。我将其更改为:

libraryDependencies ++= Seq(
    "org.typelevel" %% "cats-core" % "2.0.0",
    "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2"
)

并且有效。

我想我不完全了解%%%之间的区别

© www.soinside.com 2019 - 2024. All rights reserved.