I have a problem. I am trying to listen to WorkLogs and get Issue key. But seems like everthing I am try to do I get some error. Recently I hit one I have no idea anymore what could I’ve do.
[INFO] [talledLocalContainer] 2017-03-31 11:23:42,164 QuickReload - Plugin Installer ERROR [c.a.p.osgi.factory.OsgiPlugin] Plugin ‘com.jira.test.MyProject’ never resolved service ‘&eve
ntPublisher’ with filter ‘(&(objectClass=com.atlassian.event.api.EventPublisher)(objectClass=com.atlassian.event.api.EventPublisher))’
[INFO] [talledLocalContainer] 2017-03-31 11:23:42,164 QuickReload - Plugin Installer DEBUG [c.a.activeobjects.osgi.ActiveObjectsServiceFactory] onPluginDisabledEvent removing delegate
for [com.jira.test.MyProject]
My java .class
package com.jira.test;
import com.atlassian.event.api.EventListener;
import com.atlassian.event.api.EventPublisher;
import com.atlassian.jira.event.issue.IssueEvent;
import com.atlassian.jira.event.type.EventType;
import com.atlassian.jira.issue.Issue;
import com.atlassian.plugin.spring.scanner.annotation.export.ExportAsService;
import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;
import com.atlassian.sal.api.lifecycle.LifecycleAware;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;
import javax.inject.Inject;
import javax.inject.Named;
(at)ExportAsService
(at)Component
(at)Named(“IssueCreatedResolvedListener”)
public class IssueCreatedResolvedListener implements InitializingBean, DisposableBean, LifecycleAware {
(at)ComponentImport private final EventPublisher eventPublisher;
(at)Inject public IssueCreatedResolvedListener(final EventPublisher eventPublisher) { this.eventPublisher = eventPublisher; }
// (at)ComponentImport
// private final ApplicationProperties applicationProperties;
// (at)ComponentImport
// protected final LifecycleManager lifecycleManager;
(at)Override public void afterPropertiesSet() throws Exception { eventPublisher.register(this); }
(at)EventListener public void onIssueEvent(IssueEvent issueEvent) { if (issueEvent.getEventTypeId().equals(EventType.ISSUE_WORKLOG_DELETED_ID) || issueEvent.getEventTypeId().equals(EventType.ISSUE_WORKLOG_UPDATED_ID) || issueEvent.getEventTypeId().equals(EventType.ISSUE_WORKLOGGED_ID)) {
Issue issue = issueEvent.getIssue(); String s = issue.getKey(); } }
public void onStart() {
}
public void onStop() {
}
public void destroy() throws Exception { eventPublisher.unregister(this); }
}
My POM dependencys
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.1.6.RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.event</groupId>
<artifactId>atlassian-event</artifactId>
<version>2.3.5</version>
</dependency>
<dependency>
<groupId>com.atlassian.sal</groupId>
<artifactId>sal-api</artifactId>
<version>3.0.2</version>
</dependency>
Any tips would be welcome!