在 Play Framework 2.0 中使用 Eclipse
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10038673/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Using Eclipse with Play Framework 2.0
提问by Joe
I am new to Framework 2.0. In Play 1.0, after you Eclipsify your project, you have have a *.launch file that you can use to launch your project.
我是框架 2.0 的新手。在 Play 1.0 中,在 Eclipsify 项目后,您有一个 *.launch 文件,可用于启动项目。
After you eclipsify in Play 2.0, you don't seem to have anything similar. Is there a way to control your launching and to debug Play 2.0, using Eclipse?
在 Play 2.0 中 eclipsify 之后,您似乎没有任何类似的东西。有没有办法使用 Eclipse 控制您的启动和调试 Play 2.0?
A similar question: Debug Playframework 2.0 in Eclipse
一个类似的问题: Debug Playframework 2.0 in Eclipse
The answer to that question did not have specific enough instructions for me to know how to follow.
该问题的答案没有足够具体的说明让我知道如何遵循。
回答by Franz
Question 1:
问题 1:
After you have eclipsified, open Eclipse and choose File -> Import... -> Existing Projects into Workspace
. A dialog will open, choose your Play Framework 2.0 project folder and click Finish
.
完成 Eclipse 后,打开 Eclipse 并选择File -> Import... -> Existing Projects into Workspace
. 将打开一个对话框,选择您的 Play Framework 2.0 项目文件夹并单击Finish
。
Question 2:
问题2:
Start your Play Framework application using
play debug run
. You will see something like this:Listening for transport dt_socket at address: 9999 ...
In Eclipse, right-click on your project in
Project Explorer
and chooseDebug As -> Debug Configurations...
.A new dialog called
Debug Configurations
will open. Double-click onRemote Java Application
and a new window will appear on the right side. Change theConnection properties
so that the point to hostlocalhost
and port9999
. Confirm by clicking theDebug
button.Put a breakpoint in your Application in Eclipse.
Try your application as normal in a web-browser. If it hits a breakpoint then Eclipse will be brought as frontmost and let you debug.
使用
play debug run
. 你会看到这样的事情:在地址侦听传输 dt_socket:9999 ...
在 Eclipse 中,右键单击您的项目
Project Explorer
并选择Debug As -> Debug Configurations...
.Debug Configurations
将打开一个名为的新对话框。双击Remote Java Application
,右侧会出现一个新窗口。更改Connection properties
以便指向 hostlocalhost
和 port9999
。单击Debug
按钮确认。在 Eclipse 中的应用程序中放置一个断点。
在网络浏览器中像往常一样尝试您的应用程序。如果它遇到断点,那么 Eclipse 将被置于最前面并让您进行调试。