【问题标题】:Adding scalatags to Play framework project将 scalatags 添加到 Play 框架项目
【发布时间】:2016-08-26 02:15:53
【问题描述】:

我有一个包含客户端和服务器部分的 Play 框架项目。客户端部分使用 scala.js。我正在尝试在客户端脚本中使用 scalatags。

在项目的 build.sbt 中,我将 "com.lihaoyi" %% "scalatags" % "0.5.5" 添加到 libraryDependencies。 IntelliJ 然后为我提供了 scalatags 类型的正确代码完成。页面如下:

package app

import scala.scalajs.js
import org.scalajs.dom
import scalatags.Text.all._

object App extends js.JSApp {
    def main(): Unit = {
        dom.document.getElementById("scalajsShoutOut").innerHTML = h1("Hello").render
    }
}

但是,在请求页面时,我收到编译器错误:

[error] Referring to non-existent class scalatags.Text$all$
[error]   called from app.App$.main()scala.Unit
[error]   called from scala.scalajs.js.JSApp$class.$$js$exported$meth$main(scala.scalajs.js.JSApp)java.lang.Object
[error]   called from app.App$.$$js$exported$meth$main()java.lang.Object
[error]   called from app.App$.main
[error]   exported to JavaScript with @JSExport
[error] involving instantiated classes:
[error]   app.App$
etc.

还需要什么其他设置?

【问题讨论】:

    标签: playframework scala.js scalatags


    【解决方案1】:

    您必须在 Scala.js 项目的依赖项中使用 %%% 而不是 %%

    "com.lihaoyi" %%% "scalatags" % "0.5.5"
    

    【讨论】:

    • 谢谢你。确实是简单的构建工具。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-11-19
    • 2012-11-21
    • 2015-01-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-06
    相关资源
    最近更新 更多