Not sure if this is the best way, but if your plugin adds Actions to builds,
then you would need to scan the builds of the job, and try to retrieve your
plug-in's action. Like below (not tested):
perform(AbstractBuild build) {
Action myAction = build.getAction(MyPluginAction.class);
if(myAction != null) {
// this build is using my plug-in
}
}
As for knowing if it is using other plug-ins, you can add a dependency to that
other plug-in in your plug-in, and use the approach described above. Although
you have to take care to only use that plug-in's classes if the user has the
plug-in installed. Like below (again, not tested).
Plugin myPlugin = Jenkins.getInstance().getPlugin("my-super-duper-plugin");
if(myPlugin != null) {
// It means I can use my plug-in classes, without raising
ClassNotFoundException
// Find if this job/build is using the plug-in
//...
}
Again, not sure if that's the best way for doing this, but hope that helps :o)
Bruno P. Kinoshita
http://kinoshita.eti.br
http://tupilabs.com
>________________________________
> From: Edding <[email protected]>
>To: [email protected]
>Sent: Monday, 5 November 2012 2:04 PM
>Subject: Getting the jobs that are using plugin
>
>
>Hello,
>
>
>I am writing a Jenkins plugin and I need a way to know which jobs are
>currently using the plugin, or it may help too knowing which plugins are being
>used by a job.
>
>
>Any ideas?
>
>
>Thanks in advance
>
>