3

I am unable to use the jenkins JIRA plugin and I am writing a groovy script to make RESTAPI calls to JIRA.

However, Jenkins is not finding the classes:

ERROR: Build step failed with exception org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script1.groovy: 3: unable to resolve class com.atlassian.jira.project.version.VersionManager

Does anyone know how I can resolve this issue (without having to manually install Atlasssian SDK, and upgrade to Java 1.8 on build system)?

Thanks in advance,

Bella

Ivory Micky
  • 541
  • 1
  • 6
  • 20
  • Do you use a Jenkins plugin to run your Groovy script? Where does your script live? In its own git repo, or in a Jenkins job's configuration? You need a way to configure the classpath for your script, but how to do that depends on the answers to the previous questions. – GlennV Jul 27 '16 at 10:56
  • Hi Glenn, Yes, I have the groovy plugin installed and the script lives within the Jenkins job's configuration. – Ivory Micky Aug 01 '16 at 14:26

1 Answers1

0

VersionManager is part of the JIRA java api. You can only make use of this API if you're writing a custom add-on for JIRA server (not cloud), or if you have the Script Runner add-on installed on your JIRA instance. Either way you have to develop something that runs on your JIRA server, not a Jenkins client.

Script Runner does allow you to easily develop custom REST resources, and you can easily call those from a script that Jenkins runs in a build step. You can also skip Script Runner and just talk to the JIRA REST API directly. This can be done with Groovy, bash (depending on your client's OS) or any scripting language. Just look for REST examples for the language of your choice. If you want to stick with Groovy there are a few things you can try to add additional libraries:

Community
  • 1
  • 1
GlennV
  • 3,471
  • 4
  • 26
  • 39