首页 > 解决方案 > SBT:与号 (&) 不是 sbt.io.FileFilter 的成员

问题描述

我正在尝试使用带有以下 build.sbt 的 SBT 创建一个初学者 Scala 应用程序

name := "Jala"

version := "0.1"

scalaVersion := "2.12.8"

libraryDependencies += "org.scalatest" && "scalatest" & "2.2.6" & "test"

我收到错误:

Error while importing sbt project:

[info] Loading settings for project global-plugins from idea.sbt ...
[info] Loading global plugins from C:\Users\janac\.sbt\1.0\plugins
[info] Loading project definition from C:\source\Jala\project
C:\source\Jala\build.sbt:7: error: value & is not a member of sbt.io.FileFilter
libraryDependencies += "org.scalatest" && "scalatest" & "2.2.6" & "test"
^
[error] Type error in expression

我不明白为什么错误消息表明“&”不是有效成员......

标签: scalasbt

解决方案


而不是&使用%和附加Seq这样的:

libraryDependencies ++= Seq(
    "org.scalatest" % "scalatest" % "2.2.6")

Seq如果您在不久的将来需要,使用 a可以方便地附加更多依赖项。


推荐阅读