How can I import a custom plugin class into a Scriptrunner script?


I am working on a plugin that I want to use as a sort of custom library for JIRA. I want to wrap up usual operations like getting a custom field's value, setting it, migrating a issue to a new workflow, etc so i remove the thousand of lines of redundant code in our instance.

I am follwing Adaptavist's instructions about creating bundled scripts and I downloaded their bundled script plugin example.

My problem is that I can't manage to import a custom class into my Script Console. I have a custom class (currently just using the one implemented in teh Adaptavist example) that i tried adding as a component in atlassian-plugin.xml:


package com.onresolve.scriptrunner.canned.jira.workflow

import com.onresolve.scriptrunner.canned.CannedScript
import com.onresolve.scriptrunner.canned.util.BuiltinScriptErrors
import com.onresolve.scriptrunner.canned.util.SimpleBuiltinScriptErrors
import com.onresolve.scriptrunner.runner.customisers.ScriptListener
import groovy.util.logging.Log4j

class SampleScriptListener implements CannedScript {

//Canned script code

<component key="testScript1" name="Sample Script"
class="com.onresolve.scriptrunner.canned.jira.workflow.SampleScriptListener" public="true"


The problem is if I try to import com.onresolve.scriptrunner.canned.jira.workflow.SampleScriptListener in a groovy script, i get an unresolved reference error for my import.

I have this question floating around but I still haven't found a solution that works for me. Has anyone managed to get this to work? If yes, could you please share how you did it? I've been trying to do this for quite some time with no success.


Thank you!

1 answer

Hello Vlad, 

I think this docs could help you. It shows how to develop scripts using other JIRA plugins services.



Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,967 views 12 18
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot