7

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

3 Answers 3

6

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'] } 
Sign up to request clarification or add additional context in comments.

Comments

0

https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html#optional-plugin-dependencies

  1. build.gradle
intellij { version = '2021.2' plugins = ['Git4Idea'] } 
  1. src\main\resources\META-INF\plugin.xml
<depends>Git4Idea</depends> 

Comments

0

for the newer intelliJ, gradle is a kotlin (of some kind) based one, so the config for the

build.gradle.kts:

 // Configure Gradle IntelliJ Plugin intellij { version.set("2023.1.7") type.set("CL") // Target IDE Platform plugins.set(listOf("com.intellij.clion", "hg4idea", "Git4Idea")) } 

beware, case sensitive names for the plugins

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.