Debugging Groovy Script stops, but doesn't show code/line highlighting

When you debug Java or even a Groovy class, I can set break points, and the code stops there. The IDE actually hightlights that line of code it stopped at, and if the code file/tab wasn't up already it would pop it up with the code and highlight the line. But this does NOT happen when the breakpoint is in a Groovy Script.

All I see in the debugger window is that it stopped.

In the variables window I see.

this = GroovyScriptNameHere$_run_closure15_closure20@54d66b6c

I don't see any of the variables that have values when the code stops. I have All-Variables mode set, so they would show up. They show up in Groovy classes and Java classes just not Groovy scripts.

I could have sworn that months ago it was working, so I have no idea what could have changed. Maybe a updated version in IntelliJ that I installed?

It makes it difficult to debug. I have to put my cursor over a variable in the code and wait for the popup to show and select to see its values.

Thanks

Mark

p.s. I can't take screen shots because the code is confidential.

12 comments

Hi Mark,

What Groovy and IDEA version do you use?

0

IntelliJ 12.04 build 123.169

Groovy: 2.05

Thanks

Mark

0

Seems to be. But it definitely is NOT the same.

In that ticket, the debugger doesn't stop at all at breakpoints.

Mine breaks at the breakpoint, you just have no clue which breakpoint it actually stopped on. Because it never gets highlighted.

And, this isn't in Loops, this is in my complete Groovy script anywhere in the script. I did figure out in the threads list for doCall: that the number after is the line number But the variables only shows the closure and no other variables are visible in the variables section. But you can hover over variables in code and it pop up. As long as you are in the correct method/closure. Again no Loop closures in our code here.


MarkScreen Shot 2013-04-15 at 4.22.14 PM.png

0

Could you provide a groovy script which represents the problem?

0

Sorry it took me so long to get back. We are extremely busy and it is tough to get back. But another one of my developers just hit this for the first time he is debugging Groovy scripts and he really got frustrated trying to debug through IntelliJ here. He had no idea what was going on, so couldn't fix a simple bug in our code.

Unfortunately, I can't give you any of our code as it is very proprietary. But take any Groovy script that is using closures and you will see this.

here is a very basic script that it should still happen to. Set a break point anywhere.

callBack1 = {name ->
  println "Hello World, $name"
}

method1 = {callBack ->
  callBack
}

method2 = {
  def curriedCallBack = callBack1.curry("John")
  method1 curriedCallBack
}

method2()





I can't even run that script directly in the IDE, I get

Caused by: java.lang.ClassNotFoundException: org.apache.commons.cli.ParseException

However, it should still serve the purpose of a test script you can use. Basically, all you have to do is get it to run and set a break point anywhere and you will see that that line will stop, but not highlighted, no variables showing or anything.

Thanks

Mark
0

Debug works perferctly in my case. See attached screenshot.
It seems that it is something wrong with your Groovy lib. Could you provide a list of jars that are in your groovy library?



Attachment(s):
Screen Shot 2013-05-31 at 1.07.54 .png
0

OK, then maybe it is when remote debugging. If you can find a way to run it on the command line and connect IntelliJ to it running and stop at that line.

I can see that being the only difference.

Groovy libs

    <dependency>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy</artifactId>
      <version>2.0.6</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy-json</artifactId>
      <version>2.0.6</version>
      <scope>provided</scope>
    </dependency>



Thanks

Mark
0

I've tried remote dubug. Works as well. Could you provide a command line command you use to run the script?

0

OK, I just quickly wrote that up for this thread. I don't run that particular script from the command line and I can't give you our real code.

I know it can't be the technology we are using because I can break into Groovy classes and closures in those classes, just not the closures/code in the Script.

We are using Vert.x http://www.vertx.io which has its own command line "vertx" command that you use to run your Groovy code through Vert.x

But as I said it works perfectly fine with classes, but not with Scripts.

Thanks

Mark

0

Woould be cool if you provide a sample vert.x project and instructions how I can reproduce the issue.

0

Sorry, wish I had the time. But you can use the examples at Vert.x github repo

https://github.com/vert-x/vert.x/blob/v1.3.1.final/vertx-examples/src/main/groovy/pubsub/PubSubServer.groovy

That one should work for you. But you will need to install Vert.x and remote debug connecting to running it from the command line.

Thanks

Mark

0

Please sign in to leave a comment.