Listeners are very powerful features in JIRA. JIRA has a mechanism for throwing events whenever something happens on an issue, such as creating an issue, updating an issue, progressing on the workflows, and so on. Using listeners, we can capture these events and do special things based on our requirements.
Listeners are implemented using the atlassian-event
library. All we have to do is to register the listener class as a component and then use the EventListener
annotation to listen on the events.
Let us write a simple listener that prints a different message to the console based on different issue events. Following are the steps required.
Modify the plugin
pom.xml
to include the spring dependencies, as shown here:<dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> ...