Java functionality extracted as a plugin

In the latest EAP build of IntelliJ IDEA 2019.2 we’ve extracted Java functionality into a separate plugin. This separates the Java implementation from the “platform” part of IntelliJ IDEA and introduces some flexibility for the future. For example, we could include Java functionality as a plugin to other products, and other plugins such as Gradle can now take optional dependencies on Java, and still work if Java isn’t available.

The new plugin is not visible in Settings | Plugins and cannot be switched off, so there should be no impact on end users. However, if you’re writing a plugin for IntelliJ IDEA you may need to make some small changes to continue working correctly.

Firstly, if your plugin depends on the Java part of the IntelliJ API, you will need to declare this dependency in your plugin.xml file, by adding the following line:

You might have this line in your  plugin.xml already, as this is the recommended way of declaring a dependency on the Java functionality, even for earlier versions of IntelliJ IDEA. However, it is now required, to ensure that your plugin can access classes from the Java plugin at runtime. See the Plugin Compatibility with IntelliJ Platform Products page for more details on dependencies.

Secondly, if you’re developing a plugin using gradle-intellij-plugin, you need to tell Gradle about the Java plugin. Add the following to build.gradle in order to include classes from the Java plugin into the compilation classpath, and tell the IDE to load the plugin at runtime:

Please let us know if you have any issues.

This entry was posted in IntelliJ Platform and tagged , , , . Bookmark the permalink.

6 Responses to Java functionality extracted as a plugin

  1. Sergey Patrikeev says:

    Please note that if you use gradle-intellij-plugin and IDE build used to compile your plugin is prior to 2019.2, adding intellij { plugins 'java' } in build.gradle will not work because older IDEs did not have Java plugin. So you will need to update intellij.version value to 2019.2 or higher

  2. Mariano de Achaval says:

    How do we build a plugin that works for new and old intellij versions if we need to have this property

    • Sergey Patrikeev says:

      In this case you have to declare dependency in plugin.xml:
      this module is available both in old and new IntelliJ versions.

      If you compile your plugin against IDE prior to 192, no additional steps are required, because Java plugin’s classes will be available in class-path of your plugin by default, since they were part of the platform jars.

      But if you compile your plugin against 192+ and use gradle-intellij-plugin, it is necessary to add intellij { plugins 'java' } to build.gradle to make Gradle add Java-plugin (now separated jars) to the class-path, otherwise your plugin will not compile. Note that this is required only to build the plugin. It will perfectly work in old IDEs if allows so.

  3. Luke Imhoff says:

    This also affects usage of the JPS builder system if you’re using that for building projects.

  4. Joachim Beckers says:

    For build.gradle.kts, this would be the change needed:

    intellij {

Leave a Reply

Your email address will not be published. Required fields are marked *