我正在尝试为jira编写一个事件监听器插件。当我去旧的方式(其最新的SDK Atlassian的6.2.9一样),并把这些2线春季扫描仪未检测到组件
<component key="eventListener" class="jira.plugins.listeners.MyEventListener"/>
<component-import key="eventPublisher" class="com.atlassian.event.api.EventPublisher"/>
,并尝试打包插件我得到一个警告说I cannot use component/component-import statement inside plugin descriptor file when Atlassian plugin key is set
。最新的SDK使用Spring Scanner,它在骨架创建期间自动添加到pom.xml文件中,并强烈建议使用哪些文档。所以我删除从Atlassian的-plugin.xml文件的两行,并尝试与相应的注解来替代它们:
@Component
public class MyEventListener{
@Inject
public MyEventListener(@ComponentImport EventPublisher eventPublisher){
eventPublisher.register(this);
}
}
我可以编译和打包这种方式,但是当我在一个运行实例吉拉安装它,在插件的说明中,它表示This plugin has no modules
。我已经尝试将@Component改为@Named,将所有addind @ExportAsService都改为无效。看来春季扫描仪不会将我的课程作为一个组件进行检测。有没有人能够解决这个问题?我已写信给atlassian社区,但迄今尚未收到任何消息。
我最近碰到这个也是,我还没有想出如何让模块在列表中显示出来,但我发现我的'@ EventListener's真的被称为反正。 您是否尝试过在您的'@ EventListener'方法和/或构造函数中添加一些日志记录? –
是的,我已经添加了日志记录,并且我没有记录任何内容。 –