ScalaJS 插件 0.6.23:"value %%% is not a member of String"

ScalaJS plugin 0.6.23: "value %%% is not a member of String"

0.6.21 迁移到 ScalaJS 0.6.23 后:

(addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.23"))

我的 sbt-build 抛出以下异常:

...
[error] /Users/mpa/dev/Github/pme123/scala-adapters/project/Settings.scala:88:20: value %%% is not a member of String
[error]     "org.scala-js" %%% "scalajs-dom" % "0.9.6"
[error]                    ^
[error] /Users/mpa/dev/Github/pme123/scala-adapters/project/Settings.scala:90:27: value %%% is not a member of String
[error]     , "com.typesafe.play" %%% "play-json" % "2.6.1"
...

这是来自 Settings.scala 的值:

  lazy val clientDependencies: Seq[Def.Setting[_]] = Def.settings(libraryDependencies ++= Seq(
    "org.scala-js" %%% "scalajs-dom" % "0.9.6"
    , "org.scala-lang.modules" %% "scala-xml" % "1.0.6"
    , ...
  ))

这就是它在 build.sbt 中的用法:

lazy val client = (project in file("client"))
  .settings(sharedSettings(Some("client")))
  .settings(clientSettings)
  .settings(clientDependencies)
  .settings(jsSettings)
  .enablePlugins(ScalaJSWeb)
  .dependsOn(sharedJs)

这是项目:https://github.com/pme123/scala-adapters

release notes of Scala.js 0.6.23

Usages of %%% in .scala files of an sbt build (under project/) need a new import:

import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._

For .sbt files, this import is automatically added, so nothing changes.

所以你需要添加

import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._

在您的 Settings.scala 文件中。