Scala in jps-plugin

It seems that there are some issues with accessing the Scala standard libraries from a jps-plugin.  For instance, when attempting to do something like `myString.nonEmpty`, I get -

Error: java.lang.NoClassDefFoundError: scala/collection/immutable/StringOps

The main plugin module works fine with the scala-sdk-2.11.7 global library, so I assumed it should work with the jps-plugin as well.
jps-plugin-scala.png

Note that things seem to work once the plugin is deployed; however, I cannot seem to get it to work when running/debugging the plugin.

Here's the exact code that causes the issue - https://github.com/carymrobbins/intellij-haskforce/blob/ae9fa3ad7c02aa1a04d640d8624bc7f3d972569e/jps-plugin/src/com/haskforce/jps/stack/StackBuilder.scala#L35-L36

Most of the .idea files are included in that repo, as well as all of the *.iml files.

4 comments
Comment actions Permalink

Hi Cary,

It seems very strange indeed.
When you run or debug plugin all dependencies are located in the

<system_dir>/plugins-sandbox/plugins/intellij-haskforce/lib

Please check that directory. Maybe there is a corrupted jar file or different versions of a same library.

0
Comment actions Permalink

I started working on a different part in the meantime, but for what it's worth, here are the jars in that directory -

$ cd ~/.IntelliJIdea14/system/plugins-sandbox/plugins/intellij-haskforce
$ find . -name \*.jar
./lib/scalaz-core_2.11-7.1.4.jar
./lib/scala-parser-combinators_2.11-1.0.4.jar
./lib/scala-library-2.11.7.jar
./lib/snakeyaml-1.16.jar
./lib/jline-2.12.1.jar
./lib/scala-compiler-2.11.7.jar
./lib/paradise_2.11.6-2.1.0-M5.jar
./lib/scala-reflect-2.11.7.jar
./lib/scala-xml_2.11-1.0.4.jar


Side note - I have had issues with the plugin run configurations giving me NoClassDefFound errors and have gotten around it by adding a script to run before the Make portion of the run config -

rm -rf ~/.IntelliJIdea14/system/plugins-sandbox/plugins/intellij-haskforce


Since then, those issues have gone away.  Not sure if it's related, but worth mentioning.

0
Comment actions Permalink

I've started work again on the Builder and am still facing the issue.  Might the jps-plugin be using a different classpath?

0
Comment actions Permalink

Ok, the problem was that I needed to include the jar in the plugin.xml file -

 
<compileServer.plugin classpath="jps/jps-plugin.jar;jps-shared.jar;scala-library-2.11.7.jar"/>


Once I did that, everything was golden.

0

Please sign in to leave a comment.