Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Plugin Project Can't Find EventListener

bscog3 May 1, 2015

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?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Robert Reiner _smartics_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 1, 2015

 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
{
}
bscog3 May 4, 2015

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.

Robert Reiner _smartics_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 4, 2015

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 ...

TAGS
AUG Leaders

Atlassian Community Events