Monday, March 12, 2012

Debugging Lift 2.4 with Eclipse

To continue my last post, launching a Lift program and debugging from Eclipse turns out to be straightforward.

The starting point was this stackoverlow thread which pointed out the existence of the RunJettyRun Eclipse plugin, which can launch a Jetty instance from within Eclipse configured for remote debugging. Here are the steps to get launching and debugging working seamlessly:

  1. Install RunJettyRun from within Eclipse the usual way, ie. menu Help > Install New Software, then copy-paste this link.
  2. Once installed, go to menu Run > Debug Configurations, and double-click Jetty Webapp. This will create a new configuration for this project.
  3. Click Apply to save this configuration, and you can now start debugging to your heart's content.

NOTE: running Jetty in SBT via ~container:start puts the web app in the root of the web server, ie. http://localhost:8080/, but this plugin defaults to http://localhost:8080/project_name. You can change this via the "Context" parameter in the debug configuration. This defaults to the project name, presumably so you can run/debug multiple web apps simultaneously.

No comments: