Which .java files can be used by ScriptRunner and differences between 8.5 and 8.13 (OSGi model)

Łukasz Sielski priv January 8, 2021

Hello,

 

I'm working intensively with Scriptrunner, and noted that for some .java it won't import classes.

so my current example is:

import com.onresolve.scriptrunner.runner.customisers.PluginModule

import com.onresolve.scriptrunner.runner.customisers.WithPlugin

import com.atlassian.applinks.core.DefaultApplicationLinkService

@WithPlugin('com.atlassian.applinks.applinks-plugin')

@PluginModule

DefaultApplicationLinkService defaultApplicationLinkService;
log.error defaultApplicationLinkService.getApplicationLinks()

 

The above code works with jira 8.5.1 but won't work with 8.13.2 (Scriptrunner in the same version) In 8.13.2 it generates error:

Can't find plugin module or OSGi service for class: com.atlassian.applinks.core.DefaultApplicationLinkService

 

DefaultApplicationLinkService is located in:

applinks-plugin-7.0.0-MNSTR-2473-sources.jar (jira 8.8.1)

applinks-plugin-8.0.0-sources.jar (jira 8.13) 

classes are locates in the same place all looks the same (in area of DefaultApplicationLinkService.java file of course.) 

 

what more the following code works:

import com.atlassian.jira.component.ComponentAccessor

import com.onresolve.scriptrunner.runner.customisers.PluginModule

import com.onresolve.scriptrunner.runner.customisers.WithPluginimport com.atlassian.applinks.api.ApplicationLinkService

import com.atlassian.applinks.core.ApplinkStatusService

ApplicationLinkService applicationLinkService = ComponentAccessor.getComponent(ApplicationLinkService)

@WithPlugin('com.atlassian.applinks.applinks-plugin')

@PluginModule

ApplinkStatusService applinkStatusService;
applicationLinkService.getApplicationLinks().each{    log.error it    log.error applinkStatusService.getApplinkStatus(it.getId())} 

 ApplinkStatusService is located in the same file in the same folder. 

 

So my question is how to determine which .java files are usable and which are not...

there are some difference in pom.xml files for this plugin which if I understand correctly in <instructions> section should contain "OSGi declaration" but I don't actually know how to read this file and if this is correct file to seek the differences. 

0 answers

Suggest an answer

Log in or Sign up to answer