如何在IntelliJ IDEA中以调试模式运行Play Framework 2.x?

时间:2014-06-14 09:04:37

标签: intellij-idea playframework playframework-2.0 typesafe-activator

我想在IntelliJ IDEA中以调试模式运行Play Framework 2.x.我在互联网上搜索过,所有结果都说你必须使用游戏机。

是否可以在IntelliJ IDEA中以调试模式运行而不使用播放控制台?

5 个答案:

答案 0 :(得分:30)

使用激活器:

  1. 从终端(非intellij终端)输入命令: activator ui
  2. 打开现有应用
  3. 选择"代码视图&在IDE中打开
  4. 在“浏览代码”中,单击“设置图标”
  5. 在Intellij IDEA中选择打开项目
  6. 生成

  7. 打开Intellij IDEA

  8. 打开项目 - 浏览您的应用目录
  9. 运行 - 编辑配置
  10. 添加新配置 - 远程
  11. 添加名称  设置  transport:socket,debugger mode:attach,Host:localhost,port:9999  模块clashpath:你的应用
  12. 工具 - 打开终端
  13. activator -jvm-debug 9999 run
  14. 运行debug
  15. 打开浏览器localhost:9000

答案 1 :(得分:9)

您需要使用Idea 12+ Ultimate Edition

  • 在Idea中安装 Play 2.0支持 Scala 和其他必需的插件
  • 在命令行中执行play idea以生成项目
  • 在Idea中打开已创建的项目(打开,不要导入)
  • 转到:菜单> 运行> 编辑配置... > 添加新配置... >选择 Play 2 App
  • 菜单> 运行新按钮将出现 Debug Run ,首先将启用带有debbuger的应用程序。

答案 2 :(得分:2)

  1. 打开Intellij IDEA
  2. 打开项目 - 浏览您的应用目录“运行 - 编辑配置”
  3. 添加新配置 - Play2
  4. http://localhost:9000 添加到网址以打开选项
  5. -Xms512M -Xmx1024M -Xss1M -XX:+ CMSClassUnloadingEnabled -XX:MaxPermSize = 256M 添加到JVM选项
  6. 将调试端口设置为9999
  7. 设置调试点并调试应用程序。干杯:)
  8. 仅供参考:以上所有字段可能已填满

    enter image description here

答案 3 :(得分:1)

准备:不要使用激活器ui或类似的项目创建。只是 在IntelliJ中打开项目。

  1. activator -jvm-debug 9999 ~run~之前的run可以自动重新生成生成的HTML页面
  2. 在IntelliJ中:
    1. 运行>编辑配置......
    2. 选择默认值/远程
    3. 点击左上角的绿色+
    4. 提供名称"播放2"
    5. 确保“传输:套接字和调试器”模式:选择“附加”
    6. 键入9999作为端口 Preferences Screenshot
    7. 按"确定"
  3. 运行> Debug Play 2(列表中的第二个条目)
  4. 专业提示:查看play-auto-refresh插件,让Chrome在更改时自动重新加载。

    (基于@ ARM的回答)

答案 4 :(得分:0)

这对我有用,而且可能更容易

  1. file menue => settings => Build, Execution, Deployment => sbt => 勾选“Enable debugging for sbt shell”

  2. idea sbt shell 现在将从启用调试开始,将端口注销为“在地址:52701 处侦听传输 dt_socket”

  3. 运行/调试配置 => 添加(加号(+)符号)=> 远程 => 设置“端口”和“使用模块类路径”

  4. 在 sbt shell 中输入 run,然后点击调试按钮

截屏

  1. 启用idea emaded sbt 调试 enter image description here
  2. sbt shell 启动日志 enter image description here
  3. 在“运行/调试”中添加远程 enter image description here
  4. 在此处输入运行 enter image description here