Removing target directory makes code uncompilable in playframework when using compile time dependency injection

51 views Asked by At

My code was working fine. I deleted the target directory and the code stopped compiling. I suppose it is because play creates certain files automatically (eg routes) which it can't find any longer. How could I make the code compile again.

The errors are

Error:(18, 8) not found: object router
import router.Routes
Error:(415, 25) not found: type Routes
  lazy val router = new Routes(httpErrorHandler, homeController,userWSRoutes, questionsWSRoutes, answersWSRoutes,assets)
C:\...\code_related\code\frontend\web\app\controllers\HomeController.scala
Error:(74, 27) object index is not a member of package views.html
            Ok(views.html.index(message, messagesApi("app.title")(langs.availables(0)),userCookieOption.get.value,resetPasswordToken.get.value))
Error:(76, 27) object index is not a member of package views.html
            Ok(views.html.index(message, messagesApi("app.title")(langs.availables(0)),"",""))

Referring to the documentation, I suppose Play generated router.Routes file and it can't find it now as I deleted the target directory. I thought that recompiling the code would regenerate it but probably it doesn't. - https://www.playframework.com/documentation/2.5.x/ScalaCompileTimeDependencyInjection

I am using Intellij IDE.

1

There are 1 answers

0
Manu Chadha On

The problem got solved if I use build project option instead of build in IntelliJ IDE's edit configuration. It seems build project rebuilds everything while build just does incremental build