where to add the groovy file for a custom listener

Bastien
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 25, 2012

Hi,

I've a simple question : where I have to put my groovy file to add it in the class path area of the custom listener interface ? (see the screeshot below)



Thanks.

1 answer

2 votes
Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 25, 2012

You have to put the file within the atlassian-jira/WEB-INF/classes/ directory of the jira installation directory, the package must match.

E.g. if your package is "bastien.listener" you have to put the groovy file to atlassian-jira/WEB-INF/classes/bastien/listener/

Henning

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 25, 2012

Maybe you can define a different directory as describe here: https://studio.plugins.atlassian.com/wiki/display/GRV/Script+Runner#ScriptRunner-Conditions%2CValidators%2CPostFunctions

But I didn't tried this until now.

Henning

Bastien
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 25, 2012

Can I test my class into the script runner to verify if it works well ?
I don't wanna build the jira war every time i have to modify my class ...

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 25, 2012

Maybe you should try to install a local JIRA test instance (standalone version). There you could change the groovy file while the system is running.

Bastien
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 25, 2012

I put my groovy file into /WEB-INF/classes/custom/listeners (my file is called MotherStatus.groovy), and i rebuild my war file.

Then, i tried to load it in script listener administration :


I have to build my class in a class file ? or can i keep the .groovy file ?

Bastien
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 26, 2012

I think i can't resolve my problem :

I want my script executed AFTER the issue passed in the new status. Because another script is executed (somewhere else) and tests the status of this issue, and it must be in the new status.
The script in the post-function is executed before the new status ... and I don't know how to do .

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 26, 2012

In your case, the file should exist at /WEB-INF/classes/custom/listeners/MotherStatus.groovy

There are other ways of doing it too.

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 26, 2012

The class in MotherStatus.groovy which extends com.atlassian.jira.event.issue.AbstractIssueEventListener must be named "MotherStatus". You don't have to put the class file in the directory, the groovy file is enough.

Shradha Singh April 6, 2015

Hi Henning My groovy script is importing multiple com.atlassian.jira.* classes , where should i keep this groovy script on Jira server such that it does not give missing class error. Basically my groovy is unable to resolve com.atlassian.jira classes

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 6, 2015

I suggest, you create a new question with a minimal script with imports not working and a detailed error description, including the used JIRA and SR version.

Suggest an answer

Log in or Sign up to answer