Runtime dependencies not added to classpath
My plugin has jar dependencies, which I just put in a libs/ folder in the plugin module. I then added lib/ as a jar dependency folder of the module, with scope "runtime". But when I run it with a default Plugin run configuration, I get NoClassDefFounds on the library jar classes. It looks like they are not added to the sandbox IDE classpath:
/usr/lib/jvm/java-6-sun/bin/java -Xms512m -Xmx2048m -XX:MaxPermSize=500m -Xbootclasspath/a:/opt/intellij-idea/idea-IC-99.32/lib/boot.jar -Didea.config.path=/home/nicoulaj/.IntelliJIdea10/system/plugins-sandbox/config -Didea.system.path=/home/nicoulaj/.IntelliJIdea10/system/plugins-sandbox/system -Didea.plugins.path=/home/nicoulaj/.IntelliJIdea10/system/plugins-sandbox/plugins -Didea.launcher.port=7539 -Didea.launcher.bin.path=/opt/intellij-idea/idea-IU-99.32/bin -Dfile.encoding=UTF-8 -classpath /usr/lib/jvm/java-6-sun/lib/tools.jar:/opt/intellij-idea/idea-IC-99.32/lib/idea_rt.jar:/opt/intellij-idea/idea-IC-99.32/lib/idea.jar:/opt/intellij-idea/idea-IC-99.32/lib/bootstrap.jar:/opt/intellij-idea/idea-IC-99.32/lib/extensions.jar:/opt/intellij-idea/idea-IC-99.32/lib/util.jar:/opt/intellij-idea/idea-IC-99.32/lib/openapi.jar:/opt/intellij-idea/idea-IC-99.32/lib/jdom.jar:/opt/intellij-idea/idea-IC-99.32/lib/log4j.jar:/opt/intellij-idea/idea-IU-99.32/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain com.intellij.idea.Main
I see the library jars are well deployed to ~/.IntelliJIdea10/system/plugins-sandbox/plugins/myplugin/lib.
I tried a lot of things, ticking/untickting "export", changing dependency scope, referencing jars one by one... Without success.
Am I missing something obvious or is this a bug ? (running IDEA 1.0.2)
Please sign in to leave a comment.
Hello Julien,
In fact the plugin classloader is supposed pick up all classes from the plugin's
lib directory automatically, regardless of whether they're passed in the
command line classpath.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
OK, got it, the library I used was loaded but did nasty things with Classloaders. Sorry for the newbie question and thanks for the answer !
I have the same problem. In my case, I keep a common directory for all my application property files (i.e. c:\property_files). I have included this directory as a Global Library (Attach Jar Directories). I have then added this as a dependency to my module.
When I run the application, the "c:\property_files" directory is not within my classpath.
I have seen this as a problem with both 10.0.2 and 10.0.3 early release.
Hello Johnnie,
"Attach Jar Directories" adds all .jar files contained in the specified directory
to the classpath. If the property_files directory does not contain any .jar
files, you should use "Attach Classes" rather than "Attach Jar Directorie".
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Thanks for the reply! That worked wonderfully!