I am developing a scala compiler plugin. The compiler plugin runs after the "refcheck" phase. It analyzes the AST(Abstract Syntax Tree)
and generates some output. In this plugin, I am loading a native library "scalaz3.dll" using System.loadLibrary
I plan to use the compiler plugin with the Eclipse Scala IDE. I set the -XPlugin
parameter in the ScalaIde preferences.
When I compile a scala source file in Eclipse, the plugin is invoked after the refchecks
phase and works fine (generates the desired output)
However, when I make changes to the the source file and compile, I am getting the following error.
The SBT builder crashed while compiling your project.
Native Library scalaz3.dll already loaded in another classloader.
Looks like the ScalaIDE generates another classloader and tries to load the plugin classes in the same process.
I was facing the same problem in the compiler plugin test case. However, I fixed it using fork in Test := true
in the build.sbt
.
But I am clueless about how to fix it in eclipse scala IDE.
Here are few related posts(although not related to eclipse scala ide):