Re: [groovy-user] Groovy debugging in Eclipse

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: [groovy-user] Groovy debugging in Eclipse

Andrew Eisenberg
Hi,

Since it doesn't seem like you are using STS, your debugging experience may not be quite as good.  In STS, we have added some extra debug support to make stepping through code easier (we also allow you to use the display/expressions views and set conditional breakpoints using groovy syntax in groovy code).

The reason why we do not include this in Groovy-Eclipse is that this support relies on STS infrastructure that allows us to use AspectJ to weave into the relevant portions of Eclipse and insert the code that we need.  

I'm guessing that you expect that when you press F5 (step into) you will go into the first line of the method that you are calling.  Unfortunately, due to Groovy's heavy use of reflection, this functionality does not work (even if you set up step filters properly).  There are some Java VM limitations that prevent stepping from working as expected when stepping through native method calls.

Where did you find the information on Run As Groovy Application?  That is very outdated information (from pre 2.0).  It would be nice to remove that information in order to prevent further confusion.

Here is some more information on debug support in STS:


ps- This kind of question is better asked on the [hidden email] mailing list.  You will get a faster response.

On Thu, May 5, 2011 at 11:30 AM, yuri2976 <[hidden email]> wrote:
I created a Groovy project with two classes:
---------------
class Main {

	static main(args) {
		println "Hello!!"
		NewClass n = new NewClass()
	}

}

class NewClass {

	public NewClass() {
		// TODO Auto-generated constructor stub
		println "TheiClass"
	}

}
--------------
I also created a debug configuration of type Groovy Script (the only one that seems to work at all) and put breakpoints on the lines
	NewClass n = new NewClass()
and 
		println "TheiClass"
When I start the debugger I hit the first breakpoint fine. However when I press step into (F5) I get ClassNotFound exception. Pressing Continue (F8) after or instead of F5 hits the second breakpoint. What am I doing wrong? Are there step-by-step instructions on how to debug Groovy in Eclipse? Google search brought up stuff referencing Run As Groovy Application which I cannot see in my Eclipse (Version: 3.6.2)

View this message in context: Groovy debugging in Eclipse
Sent from the groovy - user mailing list archive at Nabble.com.