ScriptRunner limitations

Hi,
My question is what are real limitation of SR, how far I can go without moving to plugin development.

For example, I would like to update app licenses to Developer one.
I can import:
import com.atlassian.upm.api.license.RemotePluginLicenseService
but when I try with:

import com.atlassian.upm.license.internal.PluginLicenseRepository

I get error Unable to resolve class

On SC documentation I only see this:
https://scriptrunner-docs.connect.adaptavist.com/jiracloud/limitations.html#_package_imports
but there is nothing about com.atlassain.* limitation.

Best Regards,
Lukasz

ok seem like I’ve found answer myself…
correct code is:
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.atlassian.upm.license.internal.PluginLicenseRepository

@WithPlugin(‘com.atlassian.upm.atlassian-universal-plugin-manager-plugin’)
@PluginModule
PluginLicenseRepository pluginLicenseRepository;

1 Like

Looks like you have found the answer, by default scripts only have access to classes that have been imported via OSGi from the ScriptRunner app itself.

If you want to access classes from other apps, you can use the @WithPlugin annotation which adds the ClassLoader for that app to the ClassLoader used by ScriptRunner scripts, you should then be able to load classes from that app.

You can also use @PluginModule to inject instances of components from other apps.

Cheers,

Reece

Documentation for these annotations can be found here: https://scriptrunner.adaptavist.com/6.15.0/jira/scripting-other-plugins.html