External builder classpath

Note that this is related to - https://devnet.jetbrains.com/message/5561859

To recap, in my plugin.xml file I can put the following to ensure the jars are available when running the plugin (even though actually deploying it seems to work fine without this) -

<compileServer.plugin classpath="jps/jps-plugin.jar;jps-shared.jar;scala-library-2.11.7.jar;scalaz-core_2.11-7.1.4.jar;snakeyaml-1.16.jar"/>

Trying to keep a list of required jars in your plugin.xml seems a bit hacky and hard to maintain.  I'm currently using Ivy to manage dependencies, so having to keep this in sync (and not forget any jars) is rough.

Is there any way to provide the list of jars dynamically?  I'm imagining something like -

<compileServer.plugin classpath="jps/jps-plugin.jar;jps-shared.jar;$PROJECT_DIR$/lib/*.jar"/>

I'm open to alternatives as well.  Also note that I'm using IvyIDEA, so maybe it be used as part of the solution somehow.

Comment actions Permalink


you indeed can populate classpath for external build process dynamically, just provide an implementation of
com.intellij.compiler.server.BuildProcessParametersProvider extension and override 'getClassPath' method accordingly.

Nikolay Chashnikov
"Develop with pleasure!"

Comment actions Permalink

Thanks for this, but how do you properly register it?  I've tried the following with no success -

<!-- I've tried omitting compilerServer.plugin, but then the build doesn't seem to run at all.

     If I included the following, I get

     Error:Argument for @NotNull parameter 's' of com/intellij/openapi/util/text/StringUtil.split must not be null -->

You can see the commit here - https://github.com/carymrobbins/intellij-haskforce/commit/f35cfa238da9e194f194228d5168be95ac577bbc

Comment actions Permalink

In case you're still wondering how to properly register your `buildProcess.parametersProvider`, you can give `compileServer.plugin` an empty string, like this:

<compileServer.plugin classpath=""/>

This works because `BuildProcessClasspathManager` will favor the dynamic classpath (first tag) over the static classpath (second tag):

public List<String> getBuildProcessPluginsClasspath(Project project) {
List<String> staticClasspath = getStaticClasspath();
List<String> dynamicClasspath = getDynamicClasspath(project);

if (dynamicClasspath.isEmpty()) {
return staticClasspath;
else {
return dynamicClasspath;
Comment actions Permalink

Thanks for your example Bastien, it seems to work perfectly!

Comment actions Permalink

Actually, using this approach seems to create other issues.  Now it seems like it just uses the empty classpath, so my external builder classes are not available.

See the plugin.xml and BuildClasspathProvider.


Please sign in to leave a comment.