1

I have created a new play project in Intellij IDEA 2016.2.2 according to the tutorial: https://www.jetbrains.com/help/idea/2016.2/getting-started-with-play-2-x.html (the section "Creating a project"). As a result I have got a project with file Application.scala containing:

package controllers
import play.api._
import play.api.mvc._
class Application extends Controller {
    def index = Action {
        Ok(views.html.index("Your new application is ready."))
    }
}

Then I tried to build it using Build -> Rebuild project command. But I get build error:

Error:(9, 19) object index is not a member of package views.html
    Ok(views.html.index("Your new application is ready."))

After starting the app using Run -> Run 'Play2Run' and including the target folder to the build process I managed to build the project via Build -> Rebuild project. But what should I do before building in the case I haven't launched the app via play?

Explanation why my question is not duplicate of another question: I haven't found clean project opportunity in IntelliJ. Invalidating cache of IntelliJ doesn't help as well. Also the directories target/scala-2.11/src_managed/main and target/scala-2.11/twirl/main are absent in this new project. They emerge after Run 'Play2Run' and after that I can configure this Java Build Path, but I want to avoid using Run 'Play2Run'. How can I create these directories without the Run 'Play2Run'?

user2717575
  • 369
  • 7
  • 16
  • Create a new Run Configuration – From the main menu, select Run -> Edit Configurations Click on the + to add a new configuration From the list of configurations, choose “SBT Task” In the “tasks” input box, simply put “run” Apply changes and select OK. Now you can choose “Run” from the main Run menu and run your application docs: https://www.playframework.com/documentation/2.5.x/IDE#intellij – AME Sep 06 '16 at 13:32
  • @ALEX_AME In this case I get the same build error. – user2717575 Sep 06 '16 at 13:40
  • 1
    Alright, well I know this does not solve your issue but if you just want to start the application, download activator, navigate to the directory and type "activator run". – AME Sep 06 '16 at 14:27
  • Possible duplicate of ["object index is not a member of package views.html" when opening scala play project in scala ide](http://stackoverflow.com/questions/28458597/object-index-is-not-a-member-of-package-views-html-when-opening-scala-play-pro) – piotrek1543 Sep 06 '16 at 20:04
  • Official jetbrains documentation for this https://www.jetbrains.com/help/idea/2016.2/getting-started-with-play-2-x.html – Mario Petrovic Sep 07 '16 at 11:00
  • @MarioPetrovic I have mentioned this documentation at the beginning of my question... – user2717575 Sep 07 '16 at 11:31

0 Answers0