Scala Play的Bootstrap Webjars:类文件不包含Scala注释

时间:2015-09-02 08:33:28

标签: playframework

我正在尝试使用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
  2. 中的jar
  3. 添加其他依赖项,遵循class java.lang.RuntimeException/Scala class file does not contain Scala annotation
  4. 中的类似问题

    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,没有编译错误......

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

    谢谢!

1 个答案:

答案 0 :(得分:0)

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

  1. 看看http://www.typesafe.com/activator/template/webjars-sample-play2&下载模板。
  2. 合并此模板中的build.sbt,routes,plugins.sbt ......
  3. 完成,不再有任何问题......
  4. 请注意,对于游戏2.4.2,您不应该使用" routesGenerator := InjectedRoutesGenerator"在build.sbt

    无论如何,如果有人对破碎的罐子有所了解,我仍然感兴趣!

    干杯