Accessing jenkins.model.Jenkins class from Custom Jars in Jenkins env.

25 views
Skip to first unread message

ZT

unread,
Oct 17, 2016, 3:40:01 PM10/17/16
to Jenkins Users
Hello,

I have written some custom groovy scripts (bundled as Jars) which need to access the class jenkins.model.Jenkins

I have my custom JARS installed into Jenkins and they are loaded properly (verified through the Jenkins Script Console). However, When my script imports jenkins.model.Jenkins, it fails with a NoClassDef error.

I can see the jenkins core jar in /var/jenkins_home/war/WEB-INF/lib but they do not seem to be visible to my scripts. 

I am guessing this is either a classloader or a security restriction. 

Any pointers to resolve this would be appreciated.

Regards,
Rahul

touseef

unread,
Oct 19, 2016, 5:48:48 AM10/19/16
to Jenkins Users
import hudson.model.*

It worked fine for me in my groovy scripts and i was able to able use access jenkins classes.Can i know which version of jenkins are you using.As far i now in jewnkins 2.7.4 ,there are some security updates
Reply all
Reply to author
Forward
0 new messages