How to run Play Framework 2.x in debug mode in IntelliJ IDEA?

前端 未结 4 1392
清酒与你
清酒与你 2020-12-13 11:15

I want to run Play Framework 2.x in debug mode in IntelliJ IDEA. I searched in the Internet and all results say that you have to use play console.

Is it possible to

相关标签:
4条回答
  • 2020-12-13 11:31

    You need to use Idea 12+ Ultimate Edition

    • Install Play 2.0 Support, Scala and other required plugins in Idea
    • In command line perform play idea to generate project
    • Open created project in Idea (open, don't import)
    • Go to: Menu > Run > Edit Configurations... > Add New Configuration... > choose Play 2 App
    • In Menu > Run new buttons will appear Debug and Run, first will run app with enabled debbuger.
    0 讨论(0)
  • 2020-12-13 11:47
    1. Open Intellij IDEA
    2. Open project - browse your app directory Run - Edit Configuration
    3. Add new configuration - Play2
    4. Add http://localhost:9000 to url to open option
    5. Add -Xms512M -Xmx1024M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M to JVM option
    6. Set Debug port to 9999
    7. Set your debug point and debug your application. Cheers :)

    FYI : All of the above fields might filled up already

    0 讨论(0)
  • 2020-12-13 11:49

    Using activator :

    1. From Terminal (Not intellij terminal), enter command : activator ui
    2. Open your existing app
    3. Choose "Code view & Open in IDE
    4. In Browse Code, click setting icon
    5. Choose Open Project in Intellij IDEA
    6. Generate

    7. Open Intellij IDEA

    8. Open project - browse your app directory
    9. Run - Edit Configuration
    10. Add new configuration - Remote
    11. Add name Setting transport : socket, debugger mode : attach, Host : localhost, port : 9999 module clashpath : your app
    12. Tools - Open Terminal
    13. activator -jvm-debug 9999 run
    14. Run debug
    15. Open browser localhost:9000
    0 讨论(0)
  • 2020-12-13 11:52

    Preparation: Do not use the project creation by activator ui or similar. Just open the project in IntelliJ.

    1. activator -jvm-debug 9999 ~run. The ~ before run enables automatic reloading of generated HTML pages
    2. In IntelliJ:
      1. Run > Edit Configurations...
      2. Select Defaults/Remote
      3. Click on the green + at the upper left corner
      4. Give the name "Play 2"
      5. Ensure that Transport:Socket and Debugger mode:Attach are selected
      6. Type in 9999 as port
      7. Press "OK"
    3. Run > Debug Play 2 (second entry in the list)

    Pro hint: Check out the play-auto-refresh plugin to have Chrome automatically reloading on a change.

    (based on @ARM's answer)

    0 讨论(0)
提交回复
热议问题