Search code examples
intellij-ideagradledependenciesintellij-plugin

Intellij Plugin Development - Gradle does not find dependency of IntelliJ


I am currently developing a plugin for IntelliJ and trying to use another built-in IntelliJ Plugin as dependency (git4idea). As described in the IntelliJ Plugin Development documentation, I added the required JARs to my class Path in Project Structure: Project Structure Dialog Screenshot

I also added <depends>Git4Idea</depends> to my plugin.xml file.

IntelliJ finds these jars now and Code Completion works well, no errors found... But when I try to build the Plugin with gradle I get ClassNotFound errors or errors like this:

TkGitflowBaseImpl.java:15: error: package git4idea.commands does not exist
import git4idea.commands.Git;
                        ^

Obviously, Gradle does not find these jars. Since they are part of the IntelliJ installation, I can't just add them to a lib folder and add them as local jars in the build.gradle file. As Gradle JVM, I chose the exact same JVM I chose as JVM behind the IDEA Platform SDK, so the jars should be available to Gradle.

Do you know how I can help Gradle find these jars or add them as "provided" dependencies without adding them to a lib folder?

I am using IntelliJ IDEA 2017.2.5 and Gradle 4.2.1


Solution

  • After reading through the documentation of the IntelliJ Gradle Plugin (https://github.com/JetBrains/gradle-intellij-plugin), I saw that that a "=" was missing in the build.gradle file like:

    intellij {
        version '2017.2.5'
        pluginName 'pluginname'
        plugins = ['Git4Idea']
    }
    

    instead of

    intellij {
        version '2017.2.5'
        pluginName 'pluginname'
        plugins ['Git4Idea']
    }