I'm trying to write an event listener plugin for jira. When I go the old way (which the latest Atlassian SDK 6.2.9 does) and put these 2 lines
<component key="eventListener" class="jira.plugins.listeners.MyEventListener"/>
<component-import key="eventPublisher" class="com.atlassian.event.api.EventPublisher"/>
and try to package the plugin I get a warning saying that I cannot use component/component-import statement inside plugin descriptor file when Atlassian plugin key is set
. The latest SDK uses Spring Scanner, which is added to the pom.xml file automatically during the skeleton creation and which documentation strongly recommends. So I remove those two lines from the atlassian-plugin.xml file and try to substitute them with corresponding annotations:
@Component
public class MyEventListener{
@Inject
public MyEventListener(@ComponentImport EventPublisher eventPublisher){
eventPublisher.register(this);
}
}
I can compile and package it this way, but when I install it on a running Jira instance, in the description of the plugin it says This plugin has no modules
. I've tried changing @Component to @Named , addind @ExportAsService to the class all to no avail. It seems spring scanner does not detect my class as a component. Has anyone been able to overcome this issue? I've written to atlassian community but haven't gotten any news so far.