hudson.Plugin.getWrapper()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(239)

本文整理了Java中hudson.Plugin.getWrapper()方法的一些代码示例,展示了Plugin.getWrapper()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Plugin.getWrapper()方法的具体详情如下:
包路径:hudson.Plugin
类名称:Plugin
方法名:getWrapper

Plugin.getWrapper介绍

[英]Gets the paired PluginWrapper.
[中]获取配对的插件包装器。

代码示例

代码示例来源:origin: jenkinsci/jenkins

/**
 * Report to the administrator if the plugin with the given name is older then the required version.
 *
 * @param pluginName shortName of the plugin (artifactId)
 * @param requiredVersion the lowest version which is OK (e.g. 2.2.2)
 * @param message the message to show (plain text)
 */
public void ifPluginOlderThenReport(String pluginName, String requiredVersion, String message){
  Plugin plugin = Jenkins.getInstance().getPlugin(pluginName);
  if(plugin != null){
    if(plugin.getWrapper().getVersionNumber().isOlderThan(new VersionNumber(requiredVersion))) {
      pluginsToBeUpdated.put(pluginName, new PluginUpdateInfo(pluginName, message));
    }
  }
}

代码示例来源:origin: jenkinsci/configuration-as-code-plugin

if (plugin.getWrapper().getVersion().equals(p.version)) {
if ("latest".equals(p.version) && plugin != null && plugin.getWrapper().getVersion().equals(installable.version)) {

代码示例来源:origin: jenkinsci/configuration-as-code-plugin

@Test
@Ignore //TODO: This needs to be re-enabled once we can actually dynamically load plugins
@ConfiguredWithCode("PluginManagerConfiguratorTest.yml")
public void testInstallPlugins() throws Exception {
  final Plugin chucknorris = j.jenkins.getPlugin("chucknorris");
  assertNotNull(chucknorris);
  assertEquals("1.0", chucknorris.getWrapper().getVersion());
}

代码示例来源:origin: etsy/jenkins-master-project

@Override
public boolean isApplicable(Class<? extends Job> jobType) {
  return jobType.equals(MasterProject.class) && hudson.getPlugin("slack") != null && hudson.getPlugin("slack").getWrapper().isActive();
}

代码示例来源:origin: jenkinsci/parameterized-trigger-plugin

public static boolean isConditionalBuildStepInstalled(){
      final hudson.Plugin plugin = Jenkins.getInstance().getPlugin("conditional-buildstep");
      return plugin != null ? plugin.getWrapper().isActive() : false;
    }
}

代码示例来源:origin: awslabs/aws-codepipeline-plugin-for-jenkins

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;
  }
}

代码示例来源:origin: jenkinsci/maven-plugin

if(StringUtils.isNotBlank(this.settingConfigId) || StringUtils.isNotBlank(this.globalSettingConfigId)) {
  plugin = Jenkins.getInstance().getPlugin("config-file-provider");
  if(plugin == null || !plugin.getWrapper().isEnabled()){
    LOGGER.severe(Messages.MavenModuleSet_readResolve_missingConfigProvider());
} else if (plugin != null && StringUtils.isNotBlank(this.settingConfigId)) {
  try {
    Class<? extends SettingsProvider> legacySettings = plugin.getWrapper().classLoader.loadClass("org.jenkinsci.plugins.configfiles.maven.job.MvnSettingsProvider").asSubclass(SettingsProvider.class);
    SettingsProvider newInstance = legacySettings.newInstance();
    PropertyUtils.setProperty(newInstance, "settingsConfigId", this.settingConfigId);
    Class<? extends GlobalSettingsProvider> legacySettings = plugin.getWrapper().classLoader.loadClass("org.jenkinsci.plugins.configfiles.maven.job.MvnGlobalSettingsProvider").asSubclass(GlobalSettingsProvider.class);
    GlobalSettingsProvider newInstance = legacySettings.newInstance();
    PropertyUtils.setProperty(newInstance, "settingsConfigId", this.globalSettingConfigId);

代码示例来源:origin: jenkinsci/jobConfigHistory-plugin

/**
   * @return true, if Maven integration plugin is available and active.
   */
  public static boolean isMavenPluginAvailable() {
    Jenkins jenkins = Jenkins.getInstance();
    if(jenkins == null)
      return false;
    try {
      Plugin plugin = jenkins.getPlugin("maven-plugin");
      return plugin.getWrapper().isActive();
    } catch (Exception e) {
      return false;
    }
  }
}

代码示例来源:origin: io.jenkins/configuration-as-code

if (plugin.getWrapper().getVersion().equals(p.version)) {
if ("latest".equals(p.version) && plugin != null && plugin.getWrapper().getVersion().equals(installable.version)) {

代码示例来源:origin: jenkinsci/artifactory-plugin

/**
 * Returns the version of Jenkins Artifactory Plugin or empty string if not found
 *
 * @return the version of Jenkins Artifactory Plugin or empty string if not found
 */
public static String getArtifactoryPluginVersion() {
  String pluginsSortName = "artifactory";
  //Validates Jenkins existence because in some jobs the Jenkins instance is unreachable
  if (Jenkins.getInstance() != null
      && Jenkins.getInstance().getPlugin(pluginsSortName) != null
      && Jenkins.getInstance().getPlugin(pluginsSortName).getWrapper() != null) {
    return Jenkins.getInstance().getPlugin(pluginsSortName).getWrapper().getVersion();
  }
  return "";
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * Report to the administrator if the plugin with the given name is older then the required version.
 *
 * @param pluginName shortName of the plugin (artifactId)
 * @param requiredVersion the lowest version which is OK (e.g. 2.2.2)
 * @param message the message to show (plain text)
 */
public void ifPluginOlderThenReport(String pluginName, String requiredVersion, String message){
  Plugin plugin = Jenkins.getInstance().getPlugin(pluginName);
  if(plugin != null){
    if(plugin.getWrapper().getVersionNumber().isOlderThan(new VersionNumber(requiredVersion))) {
      pluginsToBeUpdated.put(pluginName, new PluginUpdateInfo(pluginName, message));
    }
  }
}

代码示例来源:origin: etsy/jenkins-master-project

private void rebuildNotify() {
 if (masterBuild.getNotifyOnRebuild() && hudson.getPlugin("slack") != null && hudson.getPlugin("slack").getWrapper().isActive()) {
  if (masterBuild.getResult() == Result.SUCCESS) {
   SlackNotifier notifier = null;
   Map<Descriptor<Publisher>, Publisher> map = masterBuild.getProject().getPublishersList().toMap();
   for (Publisher publisher : map.values()) {
    if (publisher instanceof SlackNotifier) {
     notifier = (SlackNotifier) publisher;
    }
   }
   ActiveNotifier.MessageBuilder messageBuilder = new ActiveNotifier.MessageBuilder(notifier, masterBuild);
   String message = messageBuilder.append(" Rebuild was successful").appendOpenLink().toString();
   notifier.newSlackService(masterBuild, new StreamBuildListener(new NullOutputStream())).publish(message, "good");
  }
 }
}

相关文章