user1121525
user1121525

Reputation: 43

Using Eclipse debugging features (breakpoints etc.) for Dropwizard server development

I am currently evaluating the Dropwizard framework for one of my personal projects. My intention is to use the Eclipse IDE for development. I've followed Dropwizard's "Getting Started" guide to successfully set up the basic 'Hello Stranger!' web service. My question is pretty basic but I haven't found any documentation/pointers so far and so here it goes...

How can I set up my dropwizard maven project so that I can set breakpoints (say, inside HelloWorldResource's sayHello method) and inspect/watch values of variables etc.?

I have created a debug configuration by specifying a Main class and setting "server hello-world.yml" as the Argument. When I try to debug, the service is started and works as expected but I am unable to set breakpoints or follow control flow.

Upvotes: 4

Views: 1844

Answers (1)

wiredniko
wiredniko

Reputation: 2571

You set breakpoints in Eclipse by double clicking the line you want to insert a breakpoint to.

Alternatively just right click on the left of line number you want to insert a breakpoint and click on "Toggle Breakpoint".

[Breakpoint Screenshot]

Then you want to open the Debug perspective (Window > Open Perspective Debug).

In debug you want to press the Run button (looks like a green play button) and it will stop at your breakpoint.

You can setup multiple breakpoints by the way for before / after a function call.

Upvotes: 3

Related Questions