ScalaJS插件0.6.23:“value %%%不是String的成员”

时间:2018-06-09 11:24:27

标签: sbt scala.js

0.6.23迁移到ScalaJS 0.6.21后:

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

1 个答案:

答案 0 :(得分:6)

release notes of Scala.js 0.6.23

  

sbt版本%%%文件中.scala的使用情况(project/下)需要重新导入:

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

对于.sbt个文件,会自动添加此导入,因此不会发生任何变化。

所以你需要添加

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

Settings.scala文件中。