0
votes

How can I load a custom jar file for my Jenkins Jobs DSL groovy scripts without the classpath field?

I've inherited a Jenkins instance. This Jenkins instance has an older version of the Jenkins Jobs DSL plugin. This version of the jobs plugin has a class path fields

enter image description here

By loading this jar file, my script (in the DSL Scripts) has additional symbols/classes it may import.

However, the latest versions of the Jenkins Jobs DSL have removed this class path field. The impression I get from the mailing list) is this was done for security reasons.

Without this option, is it possible to set a different class path (or include extra jar files in my Jenkins Jobs DSL groovy scripts without this field?

1

1 Answers

1
votes

No, there isn't any direct option available. Following are the options available

Option 1: As Daniel has suggested (https://groups.google.com/forum/#!topic/job-dsl-plugin/lYgX3boW0Pk) , you can use the Script Security Plugin to add custom classpath and include the jar(s). The only overhead with this approach is, even if there is a minor difference in the jar, an approval would be required.

Option 2(Least Preferred, Last Option): If you are running Jenkins under a company network and if your confident on security, then you can consider to uncheck the Enable Security for Job DSL from Jenkins-> Configure Global Secutiry enter image description here