Hi,
I would like to create an event listener for VersionCreateEvent. Below is my code:
import com.atlassian.event.api.EventListener;
import com.atlassian.event.api.EventPublisher;
import com.atlassian.jira.event.project.VersionCreateEvent;
import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;
/**
* Created by kveluru on 4/12/17.
*/
public class VersionChangeListener implements InitializingBean, DisposableBean{
@ComponentImport
private final EventPublisher eventPublisher;
VersionChangeListener(EventPublisher eventPublisher){
this.eventPublisher = eventPublisher;
}
@Override
public void destroy() throws Exception {
eventPublisher.unregister(this);
}
@Override
public void afterPropertiesSet() throws Exception {
eventPublisher.register(this);
}
@EventListener
public void addVersionEvent(VersionCreateEvent versionCreateEvent){
System.out.println(" ******** Version created : "+versionCreateEvent.getVersion()+" *************");
}
}
I have created a version under project settings but I don’t see the log. I tried to debug but the break point at the system output never seems to be reached.
I have followed exactly everything from the tutorial: https://developer.atlassian.com/jiradev/jira-platform/guides/other/tutorial-writing-jira-event-listeners-with-the-atlassian-event-library
What am I doing wrong?