扩展jenkins插件java

时间:2015-11-25 09:50:38

标签: java maven jenkins jenkins-plugins

嘿我试图扩展一个jenkins插件,即test-result-analyzer,当我覆盖扩展类并添加我的覆盖动作类时,运行插件添加两次(插件的原始版本和我的覆盖版本)。我已经添加了我想要扩展到maven依赖的插件。然后我尝试了安装原始插件,但每次运行插件时它都是我的覆盖扩展类

@Extension 
public class IesdTestResultsAnalyzerExtension extends    TestResultsAnalyzerExtension {

@Override
public Collection<? extends Action> createFor(@SuppressWarnings("rawtypes") AbstractProject target) {

    try {
        Jenkins.getInstance().getPlugin("test-result-analyzer").stop();
    } catch (Exception e) {
        e.printStackTrace();
    }
    final List<TestResultsAnalyzerAction> projectActions = target
            .getActions(TestResultsAnalyzerAction.class);
    final ArrayList<Action> actions = new ArrayList<Action>();
    if (projectActions.isEmpty()) {
        final TestResultsAnalyzerAction newAction = new IesdTestResultAnalyzerAction(target);
        actions.add(newAction);
        return actions;
    } else {
        return projectActions;
    }
}

} 我的maven依赖

    <dependencies>
    <dependency>
        <groupId>org.jenkins-ci.plugins</groupId>
        <artifactId>test-results-analyzer</artifactId>
        <version>0.2.4-SNAPSHOT</version>
    </dependency>
</dependencies>

0 个答案:

没有答案