问题
When adding Scala.JS dependencies in SBT you use %%%
. E.g.
libraryDependencies += "be.doeraene" %%% "scalajs-jquery" % "0.9.0"
How is this done in the Gradle Scala plugin?
回答1:
%%% = the scala version + scalajs version. So something like:
val scalaJsDomV = "0.9.1"
libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % scalaJsDomV
)
would be
compile "org.scala-js:scalajs-dom_sjs0.6_2.12:0.9.1"
Or if you used the ext for multiple used versions it would be something like:
ext {
versions = [
js: 'sjs0.6',
major: '2.12', // major scala version
]
versions['scala'] = versions.major + '.2'
}
dependencies {
...
compile "org.scala-js:scalajs-dom_${versions.js}_${versions.major}:0.9.1"
}
Note that there is also a plugin that can help with scalajs: https://github.com/gtache/scalajs-gradle
来源:https://stackoverflow.com/questions/39594587/how-do-you-cross-compile-to-scala-js-with-gradle