The right approach to work with Optional Plugin Dependencies
Answered
Hello,
I want to use optional plugin dependencies in the plugin. So far it's done like this
In plugin.xml
<depends optional="true" config-file="my-plugin-maven.xml">org.jetbrains.idea.maven</depends>
In my-plugin-maven.xml
<idea-plugin>
<extensions defaultExtensionNs="com.intellij">
<projectService serviceImplementation="com.services.MavenService"/>
</extensions>
</idea-plugin>
In my code something like
class MyPluginStartupActivity : StartupActivity {
override fun runActivity(project: Project) {
val service: MavenService? = project.service()
service?.execute()
}
}
Is this the correct approach or is it better somehow differently?
Thank you!
Best regards,
Alex
Please sign in to leave a comment.
Alexand, yes - your solution is fine and straightforward.
Thank you, Jakub! I will continue in this direction.