I just started with play using activator, I created new play app using
activator new firstApp play-java
Then I opened play console using activator and run the application, app was running fine.
Then I opened the project in my intellij as SBT, the project opened and started showing errors.
in routes file there were lines
GET / controllers.HomeController.index
GET /count controllers.CountController.count
GET /message controllers.AsyncController.message
This errors are because method index, count and message are not static.
This is an obvious error since we cannot call to static method like this, why the code application is still running.
another error I am getting is in code
actorSystem.scheduler().scheduleOnce(
Duration.create(time, timeUnit),
() -> future.complete("Hi!"),
exec
);
It says this is an ambiguous method call.
My question is, if there are errors why application is running without
I created run configuration as SBT task and tried to run the app an I got bunch of errors.
解决方案
These worked for me:
Open file root\build.sbt and click 'Import Project' or 'Refresh Project'.
Open file project\plugins.sbt and click 'Import Project' or 'Refresh Project'.
This will import all required libraries and after completing libraries will be visible under project view pane 'External Libraries' tree.
Go to File > Settings, select 'Play2' under 'Languages & Frameworks'.
Under right side Compiler tab check 'Use Play 2 compiler for this project' and Apply settings.