Intellij Plugin Development : Unable to import ApplicationConfiguration class in my custom action.

Answered

I am learning how to build a plugin in intellij. My plugin is adding a custom action in "Tools" menu. When that action is clicked, I need to create a run configuration of type 'ApplicationConfiguration'.

For some reason, ApplicationConfiguration class is not accessible in implementation of my custom action. I am unable to find ApplicationConfiguration class and import it. 

I already have 'java' plugin in my build.gradle. Not sure what am I missing. How could I import ApplicationConfiguration class ?

 

plugins {
id 'java'
id 'org.jetbrains.intellij' version '0.4.17'
}

group 'com.test'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
mavenCentral()
}

dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
}

// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
version '2019.3'
}
patchPluginXml {
changeNotes """
Add change notes here.<br>
<em>most HTML tags may be used</em>"""
}

 

0
3 comments

use setPlugins in your build.gradle 

intellij {
version '2019.3'
setPlugins('java')
}

and this in your plugin.xml

<depends>com.intellij.java</depends>
0

Thanks for the response !


I tried the fix you recommended and it worked.  I had to add "com.intellij.modules.java" instead of "com.intellij.java". 

In this documentation, I read the following

Syntax for 2019.2 and later releases:

  • plugin.xml allowable alternative include <depends>com.intellij.java</depends>
  • build.gradle required to include intellij.plugins 'java'

I am developing the plugin in 2019.3.3 ultimate edition.  


Do you know why com.intellij.java did not work ?

0

Puneet,

com.intellij.module.java is a subset of com.intellij.java.

Its availability in plugin.xml depends on the SDK version that you have set in your Gradle configuration. For 2019.3 there is should be no problem with setting com.intellij.java as a dependency.

0

Please sign in to leave a comment.