I'm trying to create a custom groovy listener.
First of all, I created groovy class:
package com.custom import com.atlassian.jira.event.issue.AbstractIssueEventListener; import com.atlassian.jira.event.issue.IssueEvent; class MyListener extends AbstractIssueEventListener { void issueUpdated(IssueEvent event) { // code } }
And now, I'm trying to compile it with groovyc. I got these errors:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
MyListener.groovy: 3: unable to resolve class com.atlassian.jira.event.issu
e.AbstractIssueEventListener
@ line 3, column 1.
import com.atlassian.jira.event.issue.AbstractIssueEventListener
^
MyListener.groovy: 4: unable to resolve class com.atlassian.jira.event.issu
e.IssueEvent
@ line 4, column 1.
import com.atlassian.jira.event.issue.IssueEvent
How can I make it work?
You'll need to set a massive classpath, but you should not need to compile it. Just point the "custom listener" at the .groovy file, and it will handle compiling.
thank you Jamie for a quick answer. But how can I point the custom listener at the groovy file if in jira, as I see, I need .class file? Or what I did wrong to make a custom listener? I put .groovy file ...WEB-INF/classes/com/custom/MyListener.groovy. And inscript runner in creating a custom listener in field: name of groovy class I cannot find it. And in jira administration where listeners, I cannot find it too.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What version of jira and the plugin are you using?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I created empty file hello.class in /WEB-INF/classes/com/custom/ and then I can see him as a listener, so how can I compile my first MyListener.groovy in MyListener.class? I tried groovyc and nothing good, as you see. Set a massive classpath isn't good solution. Now, I'm trying to do it with Intellij, but I met a problem: idea doesn't understand imports with com.atlassian.jira. ... And I dont know how to add it. Can you help me please, Jamie?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use Custom Listener, and you put the .groovy file under one of your script roots, eg <jira_home>/scripts, in the correct directory according to its package.
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.