Create classes from greenhopper package during runtime

Hi everyone,

I am curious if there is some way to create classes from the greenhopper package during runtime, especially the IssueTypeService, without importing the greenhopper components via the atlassian-plugin.xml.

Thank’s in advance!


Yep, it’s possible. We do it like this, roughly:

  1. Using PluginAccessor, get module object of com.pyxis.greenhopper.jira:greenhopper-launcher module.
  2. Using reflection, get issueTypeService field from that object.

You will need to continue using reflection to call anything there, unless you import classes from greenhopper bundle.

Hope this helps,

Here’s a quick piece of code for extracting the field:

  public static Object getField(Object object, String fieldName) throws Exception {
    Field f = null;
    Class cls = object.getClass();
    Exception exception = null;
    while (cls != null) {
      try {
        f = cls.getDeclaredField(fieldName);
      } catch (NoSuchFieldException e) {
        if (exception == null) {
          exception = e;
      cls = cls.getSuperclass();
    if (f == null) throw exception;
    return f.get(object);

Hi Sereda,

thanks alot for your response and please excuse my late reaction.
I will check this out and tell you if it worked for me.