Jenkins自定义标记库

时间:2013-11-20 22:28:38

标签: java jenkins tags jelly

我是Jenkins& Jelly的新手。尝试以下列方式创建自定义标记。

标记库

package com.jenkins.plugins.chainboxparameter;

import org.apache.commons.jelly.TagLibrary;

public class ChainBoxTagLibrary extends TagLibrary {

    public ChainBoxTagLibrary() {
        registerTag("au",ApplicationUtil.class);
    }

}

标记支持

package com.jenkins.plugins.chainboxparameter;

import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.MissingAttributeException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;

public class ApplicationUtil extends TagSupport implements Constants {

    private String version;

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public void doTag(XMLOutput content) throws MissingAttributeException,
            JellyTagException {
        System.out.println("it worked " + this.version);

    }
}

果冻文件

<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"
  xmlns:i="jelly:fmt" xmlns:p="/lib/hudson/project" xmlns:chainTag="jelly:com.jenkins.plugins.chainboxparameter.ChainBoxTagLibrary">
   <chainTag:au version="1.0"/>
</j:jelly>

代码编译成功但在运行时抛出ClassNotFoundException。请帮我解决这个问题。

Caused by: java.lang.ClassNotFoundException: com.jenkins.plugins.chainboxparameter.ChainBoxTagLibrary

注意 - 此类存在于classes.jar中(在构建hpi文件时生成)

0 个答案:

没有答案