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 [2] but adding the jar to the JVM's classpath rather than adding 
it to the jar. Same result as [2].

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.

Cheers,

Edd

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/dfb93cdd-c2d9-4c05-a7d6-007158e3d821%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to