Forums

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

Scriptrunner while creating a job the inline script in throwing errors the same

Deleted user November 10, 2022

Hi,

 

We have below code that runs fine on script console but when i add the same in inline script in scriptunner  job it throws the below errors. Can anyone please suggest how to resolve this?

Code#

import com.lamrc.JiraUtils.LamJiraUtils

log.warn("version 1.0")
def lamJiraUtils = LamJiraUtils.getInstance()
lamJiraUtils.writeSPSDTIssuesToCSV("SPSDT", "/shared/csvexports/spsdt", "project = SPSDT AND created >= -1d")
log.warn("End")
When we Add the job below errors are thrown#

The script could not be compiled:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
file:/shared/home/scripts/com/lamrc/JiraUtils/LamJiraUtils.groovy: 418: unable to resolve class WithPlugin for annotation
 @ line 418, column 9.
           @WithPlugin("com.atlassian.servicedesk")
           ^

file:/shared/home/scripts/com/lamrc/JiraUtils/LamJiraUtils.groovy: 419: unable to resolve class PluginModule for annotation
 @ line 419, column 9.
           @PluginModule
           ^

file:/shared/home/scripts/com/lamrc/JiraUtils/LamJiraUtils.groovy: 420: unable to resolve class RequestTypeService
 @ line 420, column 28.
           RequestTypeService requestTypeService
                              ^

file:/shared/home/scripts/com/lamrc/JiraUtils/LamJiraUtils.groovy: 423: unable to resolve class RequestType
 @ line 423, column 21.
           RequestType getRequestType = requestTypeService.getRequestTypes(currentUser, reqQ).getResults().get(0)
                       ^

4 errors

Jobs.PNG

 

1 answer

1 accepted

2 votes
Answer accepted
Hieu
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.
November 10, 2022

It's the compile error on the class LamJiraUtils.
Seem it missing import for: 
- WithPlugin
- PluginModule 
- RequestTypeService 
- RequestType 

The simple thing is that, you can try to bring all the code from LamJiraUtils to the inline script, then continue to check and execute the script.





Deleted user November 10, 2022

Thanks for your prompt response

Hieu
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.
November 11, 2022

You're welcome!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events