Groovy scripts and listeners locations

I am upgrading our envs from a very outdated version of Jira (6.1) to the latest release.  I have a handful of groovy scripts located in the two directories below from a previous dev who provided little to no documentation on them. 

  • atlassian-jira/WEB-INF/classes/com/atlassian/jira/groovy/listeners/
  • atlassian-jira/WEB-INF/scripts/groovy/

I've noticed that after upgrading, the directories are no longer there. I am unsure the best approach to re-introduce these scripts. I believe they were originally created with ScriptRunner but I have no confirmation on that.

Would it be best to simply recreate the missing directories and place the scripts back in their original destinations?

1 answer

"Best" - no, not really. 

Script Runner uses two types of script storage.  There are "in-line" and "run from storage". 

In-line scripts are hooked into workflows, listeners, fields and so-on and are stored as part of the Jira database.  They are included in your Jira data and backups and make it easy to move, clone or upgrade.Storage scripts are files on the disk that SR refers to.  You lose them on move or upgrade, but gain the ability to source-control them outside Jira and run them without having to go through configuration change/update/restart cycles.

In this case, I would strongly recommend re-creating the directories and copying the scripts over.  In the long run, this is not great, I would want to move the scripts to a single area that I can source control, but to get you upgraded, it will work well. 

You will probably need to amend the scripts to make them compatible with the later versions.

When you say to move the scripts to a single area (for source control), how do I tell Jira how to find my groovy scripts, which are now in that other area?

When you are in the screen that configures a script, there are two boxes.  A large one for writing the in-line scripts, but also a single line for a script location.

The script location points to a file on the server's disk, usually under <jira home>/scripts - I keep all my scripts in there, under source control.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,717 views 17 21
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