【问题标题】:Bootstrap Webjars for Scala Play: class file does not contain Scala annotationScala Play 的 Bootstrap Webjars:类文件不包含 Scala 注释
【发布时间】:2015-09-02 08:33:27
【问题描述】:

我正在尝试将 Webjars Bootstrap 用于 Scala Play,但我遇到了关于 Webjars 本身的编译错误。

我遵循http://www.webjars.org/documentation 和How to use Twitter Bootstrap 2 with play framework 2.x 中的方法;我正在使用 scala play 2.4.2。我的错误是:

Compilation error

error while loading WebJarAssets, class file 
'/home/ubuntu-prod/.ivy2/cache/org.webjars/webjars-play_2.10/jars/webjars-play_2.10-2.4.0-1.jar(controllers/WebJarAssets.class)' 
is broken (class java.lang.RuntimeException/Scala class file does not contain Scala annotation) 

我尝试修复此错误的方法:

  1. 删除并重新下载/home/ubuntu-prod/.ivy2/cache/org.webjars/webjars-play_2.10/jars/webjars-play_2.10-2.4.0-1.jar中的jar
  2. 添加其他依赖项,遵循class java.lang.RuntimeException/Scala class file does not contain Scala annotation 中的类似问题

mu build.sbt 是:

[...]
libraryDependencies ++= Seq(
   "org.scalatest"  %% "scalatest"            % "2.2.4" % "test",
   "org.webjars"    %% "webjars-play"         % "2.4.0-1",
   "org.webjars"    % "bootstrap"             % "3.1.1-2",
   "org.webjars"    % "bootswatch-cerulean"   % "3.3.1+2",
   "org.webjars"    % "html5shiv"             % "3.7.0",
   "org.webjars"    % "respond"               % "1.4.2"
)
[...]

我的路线是:

GET     /                           controllers.Application.index     

# Map static resources from the /public folder to the /assets URL path
GET      /assets/*file              controllers.Assets.at(path="/public", file)
GET      /webjars/*file             controllers.WebJarAssets.at(file)

没有 Webjars,没有编译错误...

有什么办法可以解决这个问题吗?

谢谢!

【问题讨论】:

    标签: playframework


    【解决方案1】:

    通过规避它解决了我的问题。如果有人遇到同样的问题,请尝试:

    1. 查看http://www.typesafe.com/activator/template/webjars-sample-play2并下载模板。
    2. 从此模板中合并您的 build.sbt、路由、plugins.sbt...
    3. 完成,没有问题了...

    请注意,对于 play 2.4.2,您不应在 build.sbt 中使用“routesGenerator := InjectedRoutesGenerator”

    无论如何,如果有人对破罐子有任何想法,我仍然感兴趣!

    干杯

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-30
      • 2018-11-26
      • 1970-01-01
      • 2010-12-15
      • 1970-01-01
      • 1970-01-01
      • 2011-04-04
      • 2018-07-31
      相关资源
      最近更新 更多