Jenkins lets you import a shared library using:
library
But how would you do this using groovysh?
groovysh
Snowcrash.
I've been searching for a solution to the same issue. And have found a hint in Jenkins Shared Library - Importing classes from the /src folder in /vars
So, imagine, you have a directory tree src/com/example/jenkins/class.groovy. The launching command for groovy would be:
src/com/example/jenkins/class.groovy
[library-root]$ groovysh -cp src groovy:000> import com.example.jenkins.class ===> com.example.jenkins.class groovy:000> new class('string') ===> com.example.jenkins.class@53a7a60c
Copyright © 2021 Jogjafile Inc.
Snowcrash.
I've been searching for a solution to the same issue. And have found a hint in Jenkins Shared Library - Importing classes from the /src folder in /vars
So, imagine, you have a directory tree
src/com/example/jenkins/class.groovy
. The launching command for groovy would be: