Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala play - "not found: value routes" (Eclipse and IDEA)

Occasionally, and seemingly for no reason, I get "not found: value routes" compilation error in one of the view templates (after compilation). This happens either in Eclipse or IDEA.

Googling finds this but it's not possible to add mainLang = SCALA in play 2.10 (I'm using version 2.1.2).

Cleaning the project / re-eclipsifying it / seems to work, sometimes, but is there any more permenant solution / work-around?

Thanks

like image 692
Gal Avatar asked Aug 12 '13 20:08

Gal


4 Answers

sbt compile

Then IntelliJ loads the output of the compilation and everything just works for me.

like image 124
Wenli Wan Avatar answered Oct 18 '22 20:10

Wenli Wan


This can happen if the routes file does not exist or contains no routes.

like image 26
Robin Green Avatar answered Oct 18 '22 20:10

Robin Green


Since there seems to be no answer, I'll at-least describe my workaround: Instead of using

<link [email protected]("stylesheets/style.css") rel="stylesheet" type="text/css" />

in my template HTML, I'm using

<link href="assets/stylesheets/styles.css") rel="stylesheet" type="text/css" />

Since I'm not invoking routes.Assets.at, there is no issue with not finding the value routes. (However, I'm guessing this workaround will easily crumble when I would have need of more complex templates)

like image 27
Gal Avatar answered Oct 18 '22 20:10

Gal


I have this working defining an Asset Controller

object Assets extends controllers.AssetsBuilder

and having the route for assets too in the routes conf:

\#Map static resources from the /public folder to the /assets URL path
GET     /assets/*file          premise.internet_org.controllers.Assets.at(path="/public", file)
like image 1
Khaleesi Avatar answered Oct 18 '22 20:10

Khaleesi