我想为 Jenkins 的分段视图插件创建新视图。我应该如何部署我的扩展?我试图将它部署为 .jpi 文件中的新插件,但它不起作用。我应该把我的class/jar/jpi(我不知道哪个是正确的)文件放在哪里?
UPD:我试图将 jar 放入 \jenkins\plugin\sectioned-view\WEB-INF\lib 目录,它可以工作,但我怀疑这是部署该扩展的正确方法
UPD2:当我尝试将扩展部署为新插件时,启动时出现以下异常:
WARNING: Failed to load <packageName>.<mainExtensionClassName>$DescriptorImpl
java.lang.InstantiationException:<jenkinsDirectory>\plugins\installedapplicationssection\WEB-INF\lib\classes.jar might need to be rebuilt: java.lang.ClassNotFoundException: <packageName>.<mainExtensionClassName>$DescriptorImpl
at net.java.sezpoz.IndexItem.element(IndexItem.java:144)
at hudson.ExtensionFinder$Sezpoz._find(ExtensionFinder.java:628)
at hudson.ExtensionFinder$Sezpoz.find(ExtensionFinder.java:617)
at hudson.ExtensionFinder._find(ExtensionFinder.java:151)
at hudson.ClassicPluginStrategy.findComponents(ClassicPluginStrategy.java:316)
at hudson.ExtensionList.load(ExtensionList.java:295)
at hudson.ExtensionList.ensureLoaded(ExtensionList.java:248)
at hudson.ExtensionList.iterator(ExtensionList.java:138)
at hudson.ClassicPluginStrategy.findComponents(ClassicPluginStrategy.java:309)
at hudson.ExtensionList.load(ExtensionList.java:295)
at hudson.ExtensionList.ensureLoaded(ExtensionList.java:248)
at hudson.ExtensionList.get(ExtensionList.java:153)
at hudson.PluginManager$PluginUpdateMonitor.getInstance(PluginManager.java:1109)
at hudson.maven.PluginImpl.init(PluginImpl.java:54)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at hudson.init.InitializerFinder.invoke(InitializerFinder.java:120)
at hudson.init.InitializerFinder$TaskImpl.run(InitializerFinder.java:184)
at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:259)
at jenkins.model.Jenkins$7.runTask(Jenkins.java:906)
at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:187)
at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:94)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: <packageName>.<mainExtensionClassName>$DescriptorImpl
at hudson.PluginManager$UberClassLoader.findClass(PluginManager.java:985)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at net.java.sezpoz.IndexItem.element(IndexItem.java:134)
但我的课堂上已经有了这个:@Extension public static final class DescriptorImpl extends SectionedViewSectionDescriptor {
@Override
public String getDisplayName() {
return "My Section";
}
}