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.
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
Can you check if the user that is running JIRA has permission to read your groovy file?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.