Some classes are in IC-2018.3.2 but not in IU-2018.3.2
I am developing a plugin for PhpStorm using Gradle structure, so I have to depend on com.jetbrains.php, but it is only available in IntelliJ Ultimate.
So in build.gradle, I have this code:
intellij {
version = "IU-2018.3.2"
pluginName 'PocketStorm'
plugins = [
"com.jetbrains.php:$phpPlugin",
'yaml',
"PsiViewer:$psiViewer",
]
}
However, when I try to load an icon, it says com.intellij.openapi.util.IconLoader is not found in the classpath. After some debugging, I found that intellij-community/platform/util is actually not present if I set the version to IU-2018.3.2
However, IconLoader is present if I use IC-2018.3.2 as the intellij.version (but then I can't have com.jetbrains.php).
Isn't IU supposed to contain everything in IC? Otherwise, in this case, do I have to include another plugin to be able to use IconLoader?
Please sign in to leave a comment.
In addition, I see that IconLoader.class is still present in my project SDK (%AppData%\Local\JetBrains\Toolbox\apps\PhpStorm\ch-0\183.4588.24\lib\util.jar!\com\intellij\openapi\util\IconLoader.class), but when the project is in Gradle structure, the SDK seems to get ignored.
Have you added a dependency on `com.jetbrains.php` module in your plugin.xml?
Adding `ocom.jetbrains.php` would have a dependncy resolution error if the plugin is loaded with IC, so I have to delete that line when the build.gradle intellij.version is "IC".
> Adding `ocom.jetbrains.php` would have a dependncy resolution error if the plugin is loaded with IC
You need to make it optional dependency: http://www.jetbrains.org/intellij/sdk/docs/basics/plugin_structure/plugin_dependencies.html?search=dependenc#optional-plugin-dependencies
But it is a hard dependency required in my plugin. I need to actually use classes from the PHP plugin.
The problem here is that I want to actually test the plugin with IU (such that it has the PHP plugin), but when I am testing on IU it has dependency errors.
If it's a hard dependency than you don't need to load it in IC, so just add a dependency to plugin.xml. I don't see the problem in "Adding `com.jetbrains.php` would have a dependncy resolution error if the plugin is loaded with IC".
My original problem is that com.intellij.openapi.util.IconLoader is not found in the classpath when I set intelij.version as "IU" (which is the only thing I want), but for some reason, setting intellij.version to "IC" adds back the com.intellij.openapi.util.IconLoader class. I don't want to run the plugin in IC at all; I only want to run in IU.
I am not talking about the class missing in the runtime. I am talking about the compile time classpath.
Ok, let's start from the beginning. Preferably with the exception.
> However, when I try to load an icon, it says com.intellij.openapi.util.IconLoader is not found in the classpath.
What exactly it says? Who says it? Gradle or IDEA? What exactly you're doing to get this message?
> In addition, I see that IconLoader.class is still present in my project SDK (%AppData%\Local\JetBrains\Toolbox\apps\PhpStorm\ch-0\183.4588.24\lib\util.jar!\com\intellij\openapi\util\IconLoader.class),
So do you use IntelliJ SDK or Gradle with gradle-intellij-plugin? You must choose one, not both.
> After some debugging, I found that intellij-community/platform/util is actually not present if I set the version to IU-2018.3.2
`intellij-community/platform/util` is not the thing neither in IC, nor in UI. IconLoader class is located in util..jar!/com/intellij/openapi/util, which is the part of each IntelliJ-based IDE.
I am using Gradle structure. So how can I add platform/util into my compile classpath?
> So how can I add platform/util into my compile classpath?
What about other questions I asked? What SDK do you use? What's the exception (%AppData%\Local\JetBrains\Toolbox\apps\PhpStorm\ch-0\183.4588.24 is not valid for Gradle projects)? How do you run your plugin? How did you import the project into IDEA?
You just mentioned that project SDK is not used if the gradle-intellij-plugin is used. So I just tried, and indeed, using Java 1.8 or PhpStorm install-dir as the SDK did not change what is available in the classpath. So you can assume I'm using Java 1.8 as the SDK.
My build script is like this: https://gist.github.com/SOF3/b3af19a59363e6a095f1c9b6b6e0d8dc
To run the plugin, I simply use `./gradlew runIde`, but it is failing at the compile stage:
e: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
class com.intellij.openapi.components.ComponentManager, unresolved supertypes: com.intellij.openapi.util.UserDataHolder, com.intellij.openapi.Disposable
class com.intellij.openapi.vfs.VirtualFile, unresolved supertypes: com.intellij.openapi.util.UserDataHolderBase
class com.intellij.openapi.module.Module, unresolved supertypes: com.intellij.openapi.Disposable
e: ...\src\main\kotlin\io\github\sof3\pocketstorm\Icons.kt: (3, 34): Unresolved reference: IconLoader
./gradlew dependencies gives the following: https://gist.github.com/SOF3/3ddd713dfb41cf83ee7b6e4964a30c11
Classpath looks good to me, cannot recreate with the given build file. Could you share the sample project to recreate the problem? The output of `./gradlew :buildPlugin --info` would be useful too.