Gah, spotted a typo. Just to avoid confusion  should say "rather than
adding it to the *war*", not the jar.
On Monday, 12 March 2018 21:57:42 UTC, Edd Grant wrote:
> Hi folks,
> I'm using the init hook script mechanism ($JENKINS_HOME/init.groovy.d) to
> programmatically configure Jenkins. I'm building up quite a library of code
> and want to split it out in to re-usable classes, to keep things
> maintainable and make it easier to write well focused tests etc. I have
> tried the following with no luck:
> 1: Trying to split classes out in to separate scripts and using Groovy's
> 'evaluate' function to load the classes from each script (basically trying
> to re-implement some sort of importing behaviour). This doesn't work at all
> due to the way Groovy manipulates scripts.
> 2: Putting my classes in a jar file and adding this to WEB-INF/lib in the
> Jenkins war. This approach leads to classloader errors, presumably because
> the jar classloader that my code belongs to doesn't have access to Jenkins'
> PluginManager 'uberClassLoader'?
> 3: Same as  but adding the jar to the JVM's classpath rather than
> adding it to the jar. Same result as .
> Has anyone tried doing anything similar to this before? I'm really keen to
> be able to do things like organise my code in packages and keep it in small
> maintainable units. Grateful for any suggestions.
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
To view this discussion on the web visit
For more options, visit https://groups.google.com/d/optout.