0

我是 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 文件时生成)

4

0 回答 0