我正在使用IntelliJ插件并使用apache httpcore-4.2.1.jar。我关注插件结构的文档,因为Jetbrains在他们的Confluence页面上说明并使用了这个结构:
.IntelliJIDEAx0
plugins
Sample
lib
libfoo.jar
libbar.jar
classes
com/foo/.....
...
...
META-INF
plugin.xml
我的目录结构就是这个
c:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.0.1
plugins
myplugin
lib
commons-codec-1.6.jar
commons-logging-1.1.1.jar
httpclient-4.2.1-atlassian-2.jar
httpcore-4.2.1.jar
jackson-core-asl-1.9.12.jar
jackson-mapper-asl-1.9.12.jar
list.txt
myplugin.jar
META-INF
plugin.xml
com/..... #classes here
然后我使用myplugin.jar通过IntelliJ / Settings / Plugins / Install从硬盘安装此插件。
重新启动后,我遇到了这个异常
org/apache/http/protocol/HttpContext [Plugin: maca.myplugin]: org/apache/http/protocol/HttpContext [Plugin: maca.myplugin]
com.intellij.diagnostic.PluginException: org/apache/http/protocol/HttpContext [Plugin: maca.myplugin]
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentsRegistry.a(ComponentManagerImpl.java:470)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentsRegistry.a(ComponentManagerImpl.java:435)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentsRegistry.access$000(ComponentManagerImpl.java:421)
at com.intellij.openapi.components.impl.ComponentManagerImpl.a(ComponentManagerImpl.java:102)
at com.intellij.openapi.components.impl.ComponentManagerImpl.initComponents(ComponentManagerImpl.java:346)
at com.intellij.openapi.components.impl.ComponentManagerImpl.init(ComponentManagerImpl.java:86)
at com.intellij.openapi.project.impl.ProjectImpl.init(ProjectImpl.java:307)
at com.intellij.openapi.project.impl.ProjectManagerImpl.a(ProjectManagerImpl.java:279)
at com.intellij.openapi.project.impl.ProjectManagerImpl.access$300(ProjectManagerImpl.java:81)
at com.intellij.openapi.project.impl.ProjectManagerImpl$9.compute(ProjectManagerImpl.java:529)
at com.intellij.openapi.project.impl.ProjectManagerImpl$9.compute(ProjectManagerImpl.java:525)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$4.run(ProgressManagerImpl.java:275)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:501)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$6.run(ProgressManagerImpl.java:310)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:191)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:232)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:181)
at com.intellij.openapi.application.impl.ApplicationImpl$8$1.run(ApplicationImpl.java:692)
at com.intellij.openapi.application.impl.ApplicationImpl$6.run(ApplicationImpl.java:465)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:153)
Caused by: java.lang.NoClassDefFoundError: org/apache/http/protocol/HttpContext
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentsRegistry.a(ComponentManagerImpl.java:445)
... 25 more
Caused by: java.lang.ClassNotFoundException: org.apache.http.protocol.HttpContext PluginClassLoader[maca.myplugin, 0.1]
at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:77)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 28 more
似乎IntelliJ没有在插件的类加载器的类路径上放置其他库,我无法理解为什么。
有人能帮助我吗?
由于