Since this change, the modules located under lib/modules are no longer being loaded correctly.
Expected behavior
Plugin modules should still be loaded correctly even if they are placed under lib/modules, or there should be clear documentation about the expected distribution layout so the plugin continues to work.
Actual behavior
JARs placed inside lib/modules are not detected or loaded at runtime, while previously everything worked when all JARs were directly under lib/.
Impact
This breaks part of the plugin/module loading process and causes functionality that used to work to stop working.
What changed
The only apparent change is the distribution structure:
before: all .jar files were directly under lib/
now: some .jar files are inside lib/modules/
Question
Is lib/modules a supported location for plugin JARs in IntelliJ Platform plugins?
If yes, are there any additional requirements for those modules to be loaded correctly?
If not, what is the correct expected structure for plugin distribution packaging?
The main branch is using SDK version 2.14.0, which is causing the issue. The steps to reproduce the error are:
Clone the repository
Run the “Run IDE with Plugin” task
Create an empty Java project using Gradle (gradle.kts)
As soon as the project opens, you will see an error in the bottom-right corner of the IDE.
I also created another branch in the same repository called fix. The only change there is that it uses SDK version 2.13.1. If you follow the same reproduction steps, you will see that there is no error and everything works correctly. The issue occurs due to what I mentioned when I created this ticket.
@dalgarins Sorry, I’ve been busy with the upcoming release. Let me quickly explain how bundling now works in the 2.14.0+
This Gradle plugin provides you with a few plugins you can use in the project:
org.jetbrains.intellij.platform — the main plugin you apply to the (often) root module which has the plugin.xml file
org.jetbrains.intellij.platform.module — a module plugin you apply to submodules in your project, which hold XML files other than the root one
org.jetbrains.intellij.platform.base — a bare pugin that gives you access to the IntelliJ Platform dependencies and related helpers but with almost no extra tasks involved. You can use it to enhance a shared library with the access to the IntelliJ Platform.
Now, if your submodule applies the org.jetbrains.intellij.platform.module, and in your root module you have
but we decided to introduce a shorthand here due to the upcoming module v2 support.
Still, if you deal with a submodule with org.jetbrains.intellij.platform.module applied, you have an option to combine that submodule’s jar with the main jar. That’ll result in a single jar in your distribution archive:
And now if you want to keep the submodule as a regular jar in lib/, go for org.jetbrains.intellij.platform.base and the simple implementation will keep the default behavior