3

I want to be able to load a custom class from my pipeline script.

Specifically, I'm looking at having my pipeline script checkout fetch the Jenkinsfile and a number of .groovy files in the same directory (eg classA.groovy, classB.groovy)

I would expect to be able to have my pipeline script simply do a:

import classA
import classB

However, this results in an "Unable to resolve class" error.

I've tried the "pipeline-classpath-step-plugin", but it requires the main pipeline script to call its new step "AddToClassPath" and then load in an additional file which then can import.

Is there some other way to modify (or even to see) the classpath the script is running with?

Peter McNab
  • 1,031
  • 1
  • 10
  • 11
  • You can try this : [How to import a file of classes in a Jenkins Pipeline?](https://stackoverflow.com/questions/44811293/how-to-import-a-file-of-classes-in-a-jenkins-pipeline) – Emile Aug 15 '17 at 14:43

0 Answers0