Debug Playframework in Eclipse

前端 未结 7 1655
庸人自扰
庸人自扰 2021-01-30 13:17

I just moved from Netbeans to Eclipse. In Netbeans, I can debug Playframework applications out of the box. However, in Eclipse, it seems hard to configure this in order to debug

相关标签:
7条回答
  • 2021-01-30 13:45

    If you run "play eclipsify" on the project folder, it will create two run configurations. Looking at the run configuration details, you should check if the following line (or something similar) is in the "VM arguments":

    -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
    -Dplay.debug=yes
    -Dplay.id=test -Dapplication.path="${project_loc:NMKServer}"
    -Djava.endorsed.dirs="c:\Java\play-1.2.2/framework/endorsed"
    -javaagent:"c:\Java\play-1.2.2/framework/play-1.2.2.jar"
    

    Here you can configure the debugging port. With this config, I can attach to process using the instructuctions you have.

    0 讨论(0)
  • 2021-01-30 13:48

    With activator, you'll need activator -jvm-debug <port number> ~run

    0 讨论(0)
  • 2021-01-30 13:51

    First of all, you have created the configuration files for Eclipse by using the play eclipsify YourProject command, right? (If not, see Play framework documentation for more information.)

    After that, you should have a folder named eclipse in your project. In it, you should see commands Connect JDPA to YourProject.launch, YourProject.launch and Test YourProject.launch.

    Right-click on the YourProject.launch and choose Run As --> YourProject from the pop-up menu. That will start your application. When the application is running, right-click on the Connect JDPA to YourProject.launch, and choose Debug As --> Connect JDPA to YourProject.launch from the pop-up menu. That will start a debug session on your application.

    0 讨论(0)
  • 2021-01-30 13:55

    As of Play 2.0, the eclipse folder and launchers are no longer generated when you run play eclipsify. After running play eclipsify, you can debug your project in Eclipse as follows:

    1. In a console outside of eclipse, run play debug run.
    2. In Eclipse, right-click your project, then choose Debug As -> Debug Configurations...
    3. Right-click Remote Java Application, then click New.
    4. The host should already be set to localhost. Set the port to 9999 (the default port used by the play debug run command).
    5. Click Apply to save, then Debug to connect to your running Play instance.
    0 讨论(0)
  • 2021-01-30 13:58

    As of Play 2.1.2, I was getting the 'address in use' error when running play debug run.

    The fix was to edit play.bat in play-2.1.2 directory and change these two lines:

    :setDebug
    set JPDA_PORT=9999
    

    to

    :setDebug
    set JPDA_PORT=8551
    

    Then in Eclipse, select Debug Configurations, find "Remote Java Application", do New. Then set port to 8551. Now you can start play using

    play debug run
    

    And then in Eclipse start debugging using the debug configuration you created about.

    0 讨论(0)
  • 2021-01-30 14:02

    Play 2.1-RC2 : Running Play! app that is synced with Eclipse

    To make the project Eclipse compatible, got he project folder and then give command ">play eclipse". Now you can add it as an existing project form eclipse.

    Then to run it you have to first run start play in the project folder i.e. command "play"

    This will activate play server and identify the app in the project i.e. [appname]$ now you have to just give the command "run" to see your app running on the localhost:9000 or whichever port config you have specified.

    Debug mode: To run this similarly you need first give command "play" then [appname]$ "play debug run" this will by default use port 9999 so when you go to localhost:9000 in your browser and in your eclipse file -> Debug As -> Debug configuration.. -> New Remote Java Application -> connect specify port 9999 and debug

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