调用Jenkins插件的内部方法(thinBackup) [英] Calling internal methods of Jenkins plugin (thinBackup)

查看:202
本文介绍了调用Jenkins插件的内部方法(thinBackup)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要调用一些Jenkins插件的内部函数,这些似乎没有通过Jenkins CLI或远程api公开.例如,其中之一是thinBackup,我想在

I need to call internal functions of some Jenkins plugins that do not seem to be exposed via Jenkins CLI or remote api. For example, one of them is thinBackup and I'd like to call restore method avialable at https://github.com/jenkinsci/thin-backup-plugin/blob/master/src/main/java/org/jvnet/hudson/plugins/thinbackup/restore/HudsonRestore.java .

是否可以使用Java或Groovy(或其他任何方法,实际上越简单越好)?

Is this possible using Java or Groovy (or any other method really, the simpler, the better)?

推荐答案

您可以按照 maven的方法是将其添加到pom.xml

Which for maven is by adding this to the pom.xml

<dependencies>
  <dependency>
    <groupId>org.jvnet.hudson.plugins</groupId>
    <artifactId>javanet-uploader</artifactId>
    <version>1.5</version>
  </dependency>
...
</dependencies>

或者,如果您使用的是 gradle-jpi-plugin ,请将其添加到build.gradle

Alternatively if you are using the gradle-jpi-plugin you add this to the build.gradle

dependencies {
    optionalJenkinsPlugins([group: 'org.jvnet.hudson.plugins', name: 'chucknorris', version: '0.5', ext: 'jar'])
    testCompile 'org.spockframework:spock-core:0.6-groovy-1.8'
    jenkinsTest 'org.jenkins-ci.plugins:ant:1.1@jar',
                'org.jenkins-ci.plugins:javadoc:1.0@jar'
}

这在这里为chucknorris添加了一个可选的依赖项

This one here adds an optional dependency to chucknorris

要记住的重要一点是,无论哪种方式,您都只能调用公共方法

The important thing to remember is that you can only call public methods whichever way you go

这篇关于调用Jenkins插件的内部方法(thinBackup)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆