Java play application running despite of having errors- how to resolve this errors?

删除回忆录丶 提交于 2020-01-07 03:26:09

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/41918001/java-play-application-running-despite-of-having-errors-how-to-resolve-this-erro

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!