I'm trying to create my first Confluence Plugin which will be an Event Listener. I followed instructions and tutorials online, but the project won't compile. It does not know what to do with the annotation @EventListener and the IDE can't resolve the import com.atlassian.event.api.EventListener statement.
I followed this tutorial for a JIRA plugin, only I'm developing a Confluence plugin: https://developer.atlassian.com/jiradev/jira-platform/other/tutorial-writing-jira-event-listeners-with-the-atlassian-event-library
I don't see how it knows about the EventListener class because the dependency is not called out in the POM. How can I get the project to recognize the @EventListener annotation?
Community moderators have prevented the ability to post new answers.
The EventListener
is part of
<groupId>com.atlassian.event</groupId>
<artifactId>atlassian-event</artifactId>
which is a transitive dependency via
<groupId>com.atlassian.confluence</groupId>
<artifactId>confluence</artifactId>
I suppose you have this dependency in your POM?
The annotation is to be applied to methods only (just in case).
@Retention(RUNTIME) @Target(METHOD) @Documented public @interface EventListener { }
Thanks, this pointed me in the right direction. It turns out I had messed up my .m2 repository. Going back and running atlas-run in my project folder pulled down all the dependencies again. However, my project could still not recognize the @EventListener annotation. In the POM, changing scope from 'provided' to 'compile' on the confluence artifact fixed the problem. This POM was initially generated using the atlas-create-confluence-plugin command.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you are referring to the confluence artifact, I think the scope should be "provided". This is from our POM: {code} <dependency> <groupId>com.atlassian.confluence</groupId> <artifactId>confluence</artifactId> <version>${confluence.version}</version> <scope>provided</scope> </dependency> {code} Maybe the problem was a temporary one, related to the messed up local repo? Just a thought ...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.