Remote Debug Groovy in IntelliJ

Hi,

We are running a development version of JIRA in a remote server and I am trying to debug from my workstation.

In the documentation it says

Put a breakpoint on the last line. Copy the script path and run the script in the groovy admin panel. The breakpoint will be hit.

But I am not sure about how I can point Script Runner to the path of my script, assuming that's what is required.

Is it possible to debug on a remote server at all?

1 answer

1 accepted

1 vote

The IDE knows what file to open when the breakpoint is hit from the name of the class, and presumably some debug info added to the class at compile time.

However in the current version of script runner (this will change in the next major release), for scripts, you will need to wrap it in a class.

Eg:

class Foo() {
def main() {...}
}

new Foo().main()

this is a bit of a pain.

I don't think there is any difference whether you are debugging remotely or locally.

Thanks for your response Jamie.

I already have my script wrapped in a class in the same way as in your example.

However when you say

Copy the script path and run the script in the groovy admin panel.

Is the "groovy admin panel" the same as Script Runner in the Jira Addon's page? I am a bit confused with the terminology here.

If it makes any difference, my script will eventually run as a service.

I strongly advise you to run jira on your own machine, and not worry about remote debugging. If you need a copy of your production database to test then get one...

When you are finished you can deploy to production.

If you later have problems then clone the env to your dev machine. If you remote debug it will suspend the jvm when it hits a breakpoint, and freeze jira for anyone using it.

Perfect! It now makes complete sense.

I am trying to setup jira to start with JPDA on windows which I didn't have much luck so far, but I will get there.

Thank you

Yeah, it's the same. The plugin was renamed to script runner some time back.

Running the script as a file from Admin -> Script Console is a good way to test and develop the service.

The file has to be local to the jira server - you can't point it at a file on your machine. Scp it to the machine and edit it in winscp or something...

No problem... ask if you have any questions on debugging. There is some basic info here: https://jamieechlin.atlassian.net/wiki/display/GRV/Script+Runner;jsessionid=BFE83D471B6DB72BDE06F5E31B22663D#ScriptRunner-DebuggingandCodingwithIDEA- the pictures are years out of date but the principal is the same.

Just to confirm, it's all working nicely locally. I had to change the port from 8000 to 8001 as it was in use by something else.

In addition it appeared that breakpoints only worked inside the class and not in the code instantiating and executing the object's methods.

Yes, in this version of the plugin breakpoints in scripts don't work, but they do in your own classes or classes you define in scripts.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

354 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you