0

Setup details 1. IntelliJ Idea Community Edition 2018.2.5 with sbt plugin 2. PlayFramework 3. scalaVersion 2.12.8 4. Java 1.8 (open JDK) 5. sbt: bundled sbt with play-scala-hello-world-tutorial 6. Host OS: Limux Mint 18.3, KDE Plasma 5

Issue: I tried using the hello-world project template from Playframework - using IntelliJ to import it as an sbt project and accepting the default settings. After making some edits I deleted the project in the filesystem directly and replaced it with a fresh copy. However, when I run the project using the sbt_command window with the command 'run', the project launches Play bound to port 9000 and the running project still shows the 'old' modified version of the app.

Steps to reproduce the problem:

  1. Load 2.7.x version of play-scala-hello-world-tutorial
  2. Edit HomeController.scala;

    from

    def index() = Action { implicit request: Request[AnyContent] =>
      Ok(views.html.index())
    }
    

    to

    def index() = Action { implicit request: Request[AnyContent] =>
      Ok("Just Play Scala")
    }
    
  3. sbt_run
  4. Ctrl+D to quit running app (in IDE's sbt command window)
  5. Close IntellijIDEA
  6. Delete project root folder in Idea Workspace
  7. Place with fresh copy of play-scala-hello-world-tutorial scala-seed project template
  8. Import project
  9. Run using sbt 'run' command (in IDE's sbt command window)
  10. view http://localhost:9000/ => results in "Just Play Scala"

Attempted resolutions - Closed project from IntelliJ and deleted the project root folder from the IntelliJ-Idea workspace on the filesystem - Performed #1 and deleted .ivy2 and .mvn directories - Tried to reproduce the problem in a VM running Fedora28 using a text editor to replicate the changes. Everything works as expected. All changes are reloaded dynamically in play and changes are visible in the ruuning app.

Diagnosis Either IntelliJ does not work as expected/ advertised for recompiling sbt projects or I do not know how to use the IDE to properly purge previously compiled code.

Justin Kaeser
  • 5,868
  • 27
  • 46
newTricks
  • 21
  • 2
  • sorry but have you tried sbt clean? – GamingFelix Feb 24 '19 at 19:25
  • After you removed it, I suggest you try sbt clean and then compile the new project. Here's the manual to sbt https://www.scala-sbt.org/1.x/docs/Running.html – GamingFelix Feb 24 '19 at 19:33
  • Just tried sbt 'clean' and 'compile' before 'run' and it still doesn't work. – newTricks Feb 24 '19 at 19:39
  • what's the error message you get when you run it? And check so that you really removed it, I guess you probably did this. But always worth checking you're not just in the wrong directory running sbt. Perhaps you can also try Invalid Caches. There's a pretty good image showing how to do it here. They also have other suggestions you can try out in the thread. https://stackoverflow.com/questions/29166100/how-to-fully-clean-re-resolve-and-rebuild-a-scala-sbt-managed-project-in-idea – GamingFelix Feb 24 '19 at 19:50
  • Another option is to try "invalidate cache / restart" action in IntelliJ. Also I don't normally use Import in intellij. You can just "Open" a folder that contains the build.sbt file and intellij should recognize that it's a Scala/Play project. Import has caused me problems in the past. – Jacob Wang Feb 24 '19 at 23:33
  • 2
    Thank you all very much for your support. After installing atom ide I got the same results and gathered that IntelliJ is not the problem. Which lead me to try another browser and chrome browser shows the expected results. It seems Firefox Quantum v63.0 is doing something strange. Not the best root cause analysis but at least I can move forward. Thanks for all your quick suggestions/help! – newTricks Feb 25 '19 at 09:48

0 Answers0