0
votes

I'm trying to use Webjars Bootstrap for Scala Play, and I have a compilation error concerning Webjars itself.

I have followed method in http://www.webjars.org/documentation & also How to use Twitter Bootstrap 2 with play framework 2.x; I am using scala play 2.4.2. My error is:

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) 

What I have tried to fix this error:

  1. Delete & redownload the jar which is in /home/ubuntu-prod/.ivy2/cache/org.webjars/webjars-play_2.10/jars/webjars-play_2.10-2.4.0-1.jar
  2. Add other dependencies, following similar issue in class java.lang.RuntimeException/Scala class file does not contain Scala annotation

Mu build.sbt is:

[...]
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"
)
[...]

And my routes are:

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)

Without Webjars, no compilation error...

Is there something to do to fix this issue?

Thanks!

1

1 Answers

0
votes

Fixed my problem by circumvent it. If someone is facing the same issue, try:

  1. Take a look at http://www.typesafe.com/activator/template/webjars-sample-play2 & download the template.
  2. Merge your build.sbt, routes, plugins.sbt from this template...
  3. Done, no issues anymore...

Note that for play 2.4.2, you should not use "routesGenerator := InjectedRoutesGenerator" in build.sbt

Anyway if someone have an idea about the broken jar I'm still interested!

Cheers