当我尝试加载" sidepanel.jelly"时,我收到了下一个错误在我的Jenkins插件动作果冻文件中。
javax.servlet.ServletException: org.apache.commons.jelly.JellyTagException: file:/C:/Documents%20and%20Settings/Tecnoy/Escritorio/vats_eclipse/src/main/resources/org/jenkinsci/plugins/vats/VatsBuildAction/index.jelly:4:42: <st:include> No page found 'sidepanel.jelly' for class org.jenkinsci.plugins.vats.VatsBuildAction
at org.kohsuke.stapler.jelly.JellyClassTearOff.serveIndexJelly(JellyClassTearOff.java:117)
at org.kohsuke.stapler.jelly.JellyFacet.handleIndexRequest(JellyFacet.java:127)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:717)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:858)
at org.kohsuke.stapler.MetaClass$12.dispatch(MetaClass.java:390)
...
Caused by: org.apache.commons.jelly.JellyTagException: file:/C:/Documents%20and%20Settings/Tecnoy/Escritorio/vats_eclipse/src/main/resources/org/jenkinsci/plugins/vats/VatsBuildAction/index.jelly:4:42: <st:include> No page found 'sidepanel.jelly' for class org.jenkinsci.plugins.vats.VatsBuildAction
at org.kohsuke.stapler.jelly.IncludeTag.doTag(IncludeTag.java:124)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.kohsuke.stapler.jelly.CallTagLibScript$1.run(CallTagLibScript.java:99)
...
我的果冻文件有以下几行
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout" xmlns:t="/lib/hudson">
<l:layout norefresh="true">
<st:include page="sidepanel.jelly" />
<l:main-panel>
<h1>Vats Summary:</h1>
<div id="canvas-holder">
<p><canvas id="chart-area" width="300" height="300"/></p>
</div>
<script type="text/javascript" src="${resURL}/plugin/vats/scripts/chart.min.js"></script>
<script type="text/javascript">
...
</script>
<canvas id="myChart" width="400" height="400"></canvas>
</l:main-panel>
</l:layout>
</j:jelly>
我知道如何解决它?
谢谢!
答案 0 :(得分:4)
将<l:main-panel>
标记和<l:layout norefresh="true">
标记添加到index.jelly文件中。
并包括侧面板:
<st:include it="${it.build}" page="sidepanel.jelly" />
标记
果冻示例(index.jelly):
<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">
<l:layout norefresh="true">
<st:include it="${it.build}" page="sidepanel.jelly" />
<l:main-panel>
<f:validateButton title="${%Restart Jenkins}" progress="${%Restarting...}" method="JksRestart" with="" />
</l:main-panel>
</l:layout>
</j:jelly>
Java Action类示例:
package tryPublisher.tryPublisher;
import hudson.model.Action;
import hudson.model.AbstractBuild;
public class ExampleAction implements Action {
AbstractBuild<?,?> build;
public ExampleAction(AbstractBuild<?,?> build) {
this.build = build;
}
@Override
public String getIconFileName() {
return "/plugin/action.png";
}
@Override
public String getDisplayName() {
return "ExampleAction";
}
@Override
public String getUrlName() {
return "ExampleActionUrl";
}
public AbstractBuild<?,?> getBuild() {
return this.build;
}
}
Java Publisher类示例:
package tryPublisher.tryPublisher;
import java.io.IOException;
import hudson.Launcher;
import hudson.model.AbstractBuild;
import hudson.model.BuildListener;
import hudson.tasks.BuildStepMonitor;
import hudson.tasks.Publisher;
public class ExamplePublisher extends Publisher {
@Override
public BuildStepMonitor getRequiredMonitorService() {
return BuildStepMonitor.NONE;
}
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
BuildListener listener) throws InterruptedException, IOException {
build.getActions().add(new ExampleAction(build));
return true;
}
}
.jelly文件必须位于插件项目的正确资源图中。在与实现Action的Java类名称相同的映射中。 .jelly的名字也很重要。