How do I properly reference another plugin dependency at build time?

Answered

Hi, I'm trying to build a plugin that depends on the Perl5 plugin. I've opened the sandbox IDE and installed the plugin and I now see it under build/idea-sandbox/plugins/perl5.plugin

I have gone into the module settings, then Platform Settings -> SDKs -> 11 (I'm using Java 11) and then added the perl5.core-203.5784.10-EAP-SNAPSHOT.jar file to the classpath. Imports of classes from that jar inside my own .java files show proper symbol resolution. None of the imports are underlined red and click navigation to the packages such as com.perl5.lang.perl.fileTypes or a class within that such as com.perl5.lang.perl.fileTypes.PerlFileTypePackage from my import statements works just fine. However, when I build, I get this error:

/Users/majones/myplugin/src/main/java/com/mycompany/myplugiin/SubReferenceBase.java:10: error: package com.perl5.lang.perl.fileTypes does not exist
import com.perl5.lang.perl.fileTypes.PerlFileTypePackage;

Also, I have added this line to my plugin.xml

<depends>com.perl5</depends>

as well as

<psi.referenceContributor implementation="com.mycompany.myplugin.PerlSubReferenceContributor" language=""/>

inside the extensions. How can I get it to build?

I tried adding com.perl5 to my pluginDependencies array in build.gradle:

def pluginsDependencies = [
'JavaScriptLanguage',
'com.perl5'
]

but that produced a different error as that is only meant for bundled plugins:

Could not determine the dependencies of task ':prepareSandbox'.
> Cannot find builtin plugin com.perl5 for IDE: /Applications/IntelliJ IDEA.app/Contents

 
4 comments
Comment actions Permalink

The key was to specify the version otherwise it thinks it is a built in plugin:


def pluginsDependencies = [
'JavaScriptLanguage',
'com.perl5:203.5784.10-EAP-SNAPSHOT'
]

0
Comment actions Permalink

Yes, that is the documentation that I was following.  Yet I still hit the issue.

 

0
Comment actions Permalink

In your original post, you wrote about manually adding the Perl plugin's JAR file to your SDK. That is not correct when using Gradle setup: https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html#gradle

Just specify required plugins in Gradle build file and accordingly in <depends> for plugin.xml.

0

Please sign in to leave a comment.