Reputation: 5416
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
Upvotes: 12
Views: 8688
Reputation: 1
I had the same problem, its resolved when i drop the generated folders (target) and i restart my application
Upvotes: 0
Reputation: 7309
I had added .disablePlugins(PlayLayoutPlugin)
to my built.sbt "root" definition without changing the directory structure to match (see the link below explaining this). It switches from "Play application layout" to the "default sbt layout". The routes and application.conf are now expected in a different location on disk. I encountered both "not found: value routes" and "resource not found on classpath: application.conf" errors. I had copied this disablePlugins line from another project.
https://www.playframework.com/documentation/2.8.x/Anatomy#Default-sbt-layout
Upvotes: 0
Reputation: 711
sbt compile
Then IntelliJ loads the output of the compilation and everything just works for me.
Upvotes: 1
Reputation: 1
I had such error when tried build Sihouette example project https://github.com/mohiva/play-silhouette-seed/tree/master. I commented or replaced code, that caused error. For example:
def view = silhouette.UnsecuredAction.async { implicit request: Request[AnyContent] =>
//Future.successful(Ok(views.html.signUp(SignUpForm.form)))
Future.successful(Ok)
}
After that build become successful - Twirl and Routes directories created in target/scala-2.X/. I run application and restore original code.
def view = silhouette.UnsecuredAction.async { implicit request: Request[AnyContent] =>
Future.successful(Ok(views.html.signUp(SignUpForm.form)))
}
Upvotes: 0
Reputation: 3409
This happens when there is no route configuration for your Assets in the routes
file.
You must add this to your routes
file:
GET /assets/*file controllers.Assets.at(path="/public", file)
Upvotes: 0
Reputation: 3328
I had to go to the terminal and type "activator test" before Intellij would stop giving me these errors during IDE tests.
Upvotes: -1
Reputation: 469
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)
Upvotes: 1
Reputation: 33033
This can happen if the routes file does not exist or contains no routes.
Upvotes: 4
Reputation: 5416
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)
Upvotes: 5