I'll start with debugging. I'm assuming that you've done a command-line 'griffon create-app' by this point.
Debugging
Essentially, I'm running the app in debug mode and then attaching a 'remote debugger' from my IDE.
This is kind-of a 2-step approach. Let me know if you have a one-step approach.
Note: I had trouble getting NetBeans to debug groovy code properly. It just couldn't seem to find the Groovy line numbers. I'm normally an Eclipse user, so that might have something to do with it.
In this case, I'm using Eclipse. I have been using SSTS (SpringSource Tool Suite) distribution of Eclipse, (SSTS v2.1.0.SR01), and I downloaded the version with Groovy support included. I highly recommend this approach
Create an Eclipse project (File > New > Groovy Project; "Create from existing source", i.e. your [projectname] folder, as created by the command line 'griffon create-app')
You'll need to set the GRIFFON_HOME variable:
1. menu: Window > Preferences
2. drill into Java > Build Path > 'Classpath Variables', and add a GRIFFON_HOME
1. Start app in 'debug' mode
You can start the app from the command-line ('griffon debug-app'), but I'd rather not.
I'm running the debug-app task from the eclipse 'Ant' view.
1. If you cant see an Ant view, choose menu: Window > Show View > Ant
2. Drag [projectname]/build.xml from the Package Explorer view into the Ant view
3. Expand the project item and double-click debug-app.
(this has the same effect as running 'griffon debug-app')
Then, I'm noting the port number from the console output:
[exec] Listening for transport dt_socket at address: 18290
2. Start a Remote Debugger
Create and save a 'Debug Configuration':
1. menu: Run > Debug Configurations ...
2. Right-click "Remote Java Application" and select 'New'.
3. In Connection Properties, put Host: localhost, Port: 18290, then click 'Debug'.
...
Hey presto. Breakpoints work and stepping-through works great.
So, on subsequent starts, you can just double-click the 'debug-app' ant task and then pick the Debug Configuration from the toolbar (see the bug icon in your toolbar). I tend to start the remote debugger as soon as I see that port reference in the console.
Simple really. Next up, logging ...
1 comments:
Hi there,
Glad you are finding the new Groovy-Eclipse support useful, but would recommend upgrading to STS 2.2.0 and installing the M1 version of Groovy-Eclipse. We have fixed many bugs, particularly a few related to debugging and setting brekpoints.
Post a Comment