Java Code Examples for jenkins.model.Jenkins#getPlugin()
The following examples show how to use
jenkins.model.Jenkins#getPlugin() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JenkinsMetadata.java From aws-codepipeline-plugin-for-jenkins with Apache License 2.0 | 5 votes |
private static String getPluginVersion() { final Jenkins instance = Jenkins.getInstance(); if (instance != null) { final Plugin plugin = instance.getPlugin(PLUGIN); if (plugin != null) { return plugin.getWrapper().getVersion(); } } return UNKNOWN; }
Example 2
Source File: DockerTraceabilityPlugin.java From docker-traceability-plugin with MIT License | 5 votes |
/** * Retrieves the plugin instance. * @return {@link DockerTraceabilityPlugin} * @throws IllegalStateException the plugin has not been loaded yet */ public static @Nonnull DockerTraceabilityPlugin getInstance() { Jenkins j = Jenkins.getInstance(); DockerTraceabilityPlugin plugin = j != null ? j.getPlugin(DockerTraceabilityPlugin.class) : null; if (plugin == null) { // Fail horribly // TODO: throw a graceful error throw new IllegalStateException("Cannot get the plugin's instance. Jenkins or the plugin have not been initialized yet"); } return plugin; }
Example 3
Source File: ScmJobEventTriggerMatcher.java From aws-codecommit-trigger-plugin with Apache License 2.0 | 4 votes |
private boolean isMultiScmAvailable() { final Jenkins jenkins = Jenkins.get(); boolean hasPlugin = jenkins.getPlugin("multiple-scms") != null; log.debug("Multiple-SCMs plugin found: %s", hasPlugin); return hasPlugin; }
Example 4
Source File: ScmJobEventTriggerMatcher.java From aws-codecommit-trigger-plugin with Apache License 2.0 | 4 votes |
private boolean isGitScmAvailable() { final Jenkins jenkins = Jenkins.get(); boolean hasPlugin = jenkins.getPlugin("git") != null; log.debug("Git plugin found: %s", hasPlugin); return hasPlugin; }