I started developing a jira addon, but I'm getting errors.
My latest one, which I'm unable to fix is
[INFO] [talledLocalContainer] QuickReload - Plugin Installer ERROR [c.a.p.osgi.factory.OsgiPlugin] Plugin 'xy' never resolved service '&classname' with filter '(&(objectClass=xy.classname)(objectClass=xy.classname))'
What is going wrong here?
That happens when you try to inject on an object of your plugin another object of your plugin and you do it as if the another object was of another different plugin and was exported as a public OSGi service.
In JIRA, you can declare your plugin Java classes as components. That means that the instantiation and dependency injection (through constructor for example) will be automatically delegated on the Spring Framework which is part of JIRA. Usually we do this to lose care about instantiation and class dependencies. There are two types of components, public and private. Public components will be available to import for different plugins than yours. Other plugins can import them and then use them through dependency injection. Private components will work the same as public ones but other plugins will not be able to import or see them.
If you have one component, say A
, which depends on another component, B
, both of them part of your plugin, you should not import component B
to be available for A
because it is already part of your plugin. Before JIRA 7 for importing a component you placed on the atlassian-plugin.xml
a <component-import>
element. JIRA 7 onwards you put @ComponentImport
before the constructor parameter when you do dependency injection through constructor.
So I think what you did wrong was to put <component-import>
on a component that comes directly from your plugin instead of having <component>
. Or if you have JIRA 7 or later version what you did wrong was to put @ComponentImport
before a component of your own plugin and the solution there would be to remove that annotation. At least this last one was my case and removing that annotations from dependency injection of components coming from the same plugin I made it to work.