简体   繁体   中英

Accessing a Jenkins plugin package from a Groovy script

How can I find the path to a Jenkins plugin if I want to use it from a groovy script?

For example, just testing on the master, I'd like to be able to use the LabelParameterValue class from the NodeLabelParameter plugin. An example of what I'm looking for is below, (though it doesn't work).

currentParameters.add(new hudson.plugins.nodelabelparameter.LabelParameterValue(nodeName))

In Postbuild Groovy script you can specify Additional groovy classpath . For example: /var/jenkins/plugins/claim/WEB-INF/classes for Claim plugin code. I tried it and it worked.

Unfortunately the path has to be absolute and does not allow for environment variables (such as ${JENKINS_HOME} ). Also, I am not entirely sure where the script will look when run on a slave - on the slave or on master.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM