Compatability warning in plugin verification
Answered
In plugin https://plugins.jetbrains.com/plugin/15057-ktlint the plugin verification shows following compatability warnings:
The plugin distribution bundles IDE packages 'org.jetbrains.org.objectweb.asm.signature', 'org.jetbrains.org.objectweb.asm.commons', 'org.jetbrains.org.objectweb.asm', 'org.jetbrains.org.objectweb.asm.util', 'org.jetbrains.org.objectweb', 'org.jetbrains.org.objectweb.asm.tree.analysis', 'org.jetbrains.concurrency', 'org.jetbrains.org.objectweb.asm.tree', 'org.jetbrains.org'. Bundling IDE packages is considered bad practice and may lead to sophisticated compatibility problems. Consider excluding these IDE packages from the plugin distribution. If your plugin depends on classes of an IDE bundled plugin, explicitly specify dependency on that plugin instead of bundling it
The plugin is based on the intellij-plugin-template. The plugin.xml contains following:
<idea-plugin>
<id>com.nbadal.ktlint</id>
<name>Ktlint</name>
<vendor url="https://nbad.al">Nick Badal</vendor>
<depends>com.intellij.modules.platform</depends>
<depends>org.jetbrains.kotlin</depends>
<extensions defaultExtensionNs="com.intellij">
<externalAnnotator language="kotlin" implementationClass="com.nbadal.ktlint.KtlintAnnotator" id="KtlintAnnotator"/>
<postFormatProcessor implementation="com.nbadal.ktlint.KtlintPostFormatProcessor" />
<projectConfigurable groupId="tools" displayName="KtLint" id="preferences.ktlint-plugin"
instance="com.nbadal.ktlint.KtlintConfig"/>
<errorHandler implementation="com.nbadal.ktlint.KtlintErrorHandler" />
<notificationGroup id="Ktlint Notifications" displayType="BALLOON"/>
<actionOnSaveInfoProvider implementation="com.nbadal.ktlint.KtlintActionOnSaveInfoProvider"
order="after FormatOnSaveInfoProvider"/>
<actionOnSave implementation="com.nbadal.ktlint.KtlintActionOnSave" order="after FormatOnSaveAction"/>
</extensions>
<actions>
<action id="Ktlint.Lint" class="com.nbadal.ktlint.actions.LintAction"
text="Show All Ktlint Violations In File" description="Show all Ktlint violations in the current file">
<add-to-group group-id="RefactoringMenu" />
</action>
<action id="Ktlint.Format" class="com.nbadal.ktlint.actions.FormatAction"
text="Format With Ktlint" description="Apply ktlint formatting to file">
<add-to-group group-id="RefactoringMenu" />
</action>
</actions>
<projectListeners>
<listener class="com.nbadal.ktlint.KtlintFileEditorManagerListener" topic="com.intellij.openapi.fileEditor.FileEditorManagerListener" />
</projectListeners>
</idea-plugin>
I can not find any reference to objectweb
in the project code, nor in the dependency tree. In this post https://intellij-support.jetbrains.com/hc/en-us/community/posts/7508985323026-How-to-use-UIDesigner-in-plugin-correctly- it was mentioned that in general the Kotlin UI DSL should be used. The ktlint plugin project still contains a form which is created with the UIDesigner, if I am correct. Could the compatability warning be related to that form?
Your help is appreciated.
Please sign in to leave a comment.
Hello,
your plugin is indeed bundling the corresponding IDE packages.
Classes that are indicated by the Plugin Verifier are bundled in the `ktlin/lib/lib-all.jar` in your plugin ZIP file.
For example `org.jetbrains.org.objectweb.asm` a package name that is present in the `lib-all.jar`.
Usually, such unexpected classes or packages come from the 3rd-party dependencies.
I suggest:
1. Please review the dependency tree again, checking for unexpected libraries.
2. Please review the plugin packaging, specifically the creation of `lib-all.jar`.
Thanks a lot for your response. I was looking at the problem in the wrong way. The Dependency Analyzers of IntelliJ IDEA and Gradle did not show the problem. The `lib-all.jar` is created by the Shadow plugin. Drilling down in the build folder in `lib-all.jar` indeed shows that this lib contains the packages
So indeed, I have to research the 3rd-party dependencies.