Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Scriptrunner script roots subfolders

jgiraldo1 July 5, 2020

How to find out if the script runner is configured to resolve classes in subfolders of the script root folder?

In dev environment I am running jira 8 with scriptrunner 5.7.1.1-p5, and in prod jira 7 with script runner 5.5.9.

In both environments I see the scriptroot being the same exact folder.

This is what I used to confirm that:
import com.onresolve.scriptrunner.runner.ScriptRunner
import com.onresolve.scriptrunner.runner.ScriptRunnerImpl
def scriptRoots = ScriptRunnerImpl.getPluginComponent(ScriptRunner).getRootsForDisplay()?.split(", ")?.toList()

Now in test, I can add .groovy classes in subfolders of the scriptroot and scriptrunner is able to resolve class. In prod however, it is unable to resolve the same class in the same subfolder.

I am wondering what makes the difference. The scriptrunner documentation both versions of scriptrunner above say:

This version introduces the concept of script roots - these are directories in whose files and subdirectories you can keep your scripts. The advantages of this is that changes to dependent classes will be detected automatically, and get automatically recompiled.


Not sure what I am missing.

2 answers

0 votes
jgiraldo1 July 6, 2020

I noticed that when I run the import statement, a file with the .class statement gets generated in 

.../dtjira/jira-data/scriptrunner/classes/com/

when the actual .groovy class is in

../dtjira/jira-data/scripts/com/

e.g. if the .groovy file is:

 ../dtjira/jira-data/scripts/com/scriptABC.groovy

when I run the import statement a .class file gets generated:

.../dtjira/jira-data/scriptrunner/classes/com/scriptABC.class

This even though the console returns:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script300.groovy: 1: unable to resolve class com.bloomberg.dtjira.BasClientUtilities @ line 1, column 1. import com.bloomberg.dtjira.BasClientUtilities ^ 1 error

So it would seem to me that this is partially working, and may be Groovy actually uses the .class file and not the .groovy file



0 votes
Italo Qualisoni [e-Core]
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.
July 5, 2020

Can you check if the user that is running JIRA has permission to read your groovy file? 

jgiraldo1 July 6, 2020

Hi. Yes, I have confirmed that the user has permission to read the file.

Suggest an answer

Log in or Sign up to answer