Problems getting Jira Plugin tutorial to work with Jira v4

The goal

I am a beginner with Jira/Maven and am trying to learn how to create Jira plugins. I'm working with the tutorial.

I find it works (when I run atlas-debug) and the jira.version element in the POM is set to 6.1.1 or 6.0.1. However, I want to get the tab panel example working with Jira version 4.4.5.

Jar file woes

At first I had problems with missing jars: com.sun.jdmk:jmxtools:jar:1.2.1 and com.sun.jmx:jmxri:jar:1.2.1. I tried various methods to overcome this, but: installing the JARs via mvn didn't work, and adding a dependency and repositories element to my POM didn't work.

Eventually I got the error to go away by adding:

<exclusions> <exclusion> <groupId>com.sun.jdmk</groupId> <artifactId>jmxtools</artifactId> </exclusion> <exclusion> <groupId>com.sun.jmx</groupId> <artifactId>jmxri</artifactId> </exclusion> </exclusions> 

... to all of the dependencies in my POM. I've done it to all of them because I'm not sure which one of them is causing the error. The dependencies I have are:

  • com.atlassian.jira
  • junit
  • com.atlassian.plugins
  • javax.ws.rs
  • com.google.code.gson
  • org.slf4j
  • org.mockito

I tried just including the exclusions element inside org.slf4j but the error was still there. Does anyone know which dependency/dependencies that depend on these jars?

POM Jira version doesn't seem to change which Jira version starts

When I finally did get it to work (as above), I find it starts JIRA v6.1.1 !

I don't understand this, as my POM file says:

<properties> <jira.version>4.4.5</jira.version> <amps.version>4.2.10</amps.version> <plugin.testrunner.version>1.1.2</plugin.testrunner.version> <!-- TestKit version 5.x for JIRA 5.x, 6.x for JIRA 6.x --> <testkit.version>5.2.26</testkit.version> </properties> 

How can I get this tutorial to work with Jira version 4.4.5?

3 answers

This widget could not be displayed.

when ever you change pom content don't forgot to run the following commands

atlas-clean
atlas-mvn eclipse:eclipse
atlas-run

I don't use eclipse, we have IntelliJ

you can run the follwoing command

atlas-mvn package

once you modifies the pom.xml then navigate to the folder where pom.xml is there in command prompt then run the following commands

atlas-clean
atlas-mvn package
atlas-run

By the "package", do you mean the plugin key, as in:

<atlassian-plugin key="com.stygian.jira.plugins.tabpanel"

I've tried:

atlas-mvn com.stygian.jira.plugins.tabpanel

and:

atlas-mvn tabpanel

Both of these result in an error:

[INFO] Invalid task 'com.stygian.jira.plugins.tabpanel': you must specify a vali

d lifecycle phase, or a goal in the format plugin:goal or pluginGroupId:pluginAr

tifactId:pluginVersion:goal

I've navigated to the pom.xml folder and tried to run these commands. atlas-clean seemed to be ok. However, when I ran atlas-mvn package I get:

[INFO] Compilation failure

C:\Users\paul\atlassian-plugin-sdk\tabpanel\src\main\java\com\stygian\jira\plugins\panels\DemoIssueTabPanel.java[5,46] error: package com.atlassian.jira.plugin.issuetabpanel does not exist

This widget could not be displayed.

I'm not sure the tutorial's code is valid for Jira 4.4, however, let's solve the second question first, i.e. that you've changed your pom.xml correctly, but the latest version of Jira starts up

This is because the kit does something quite simple when you run the build - it looks for a Jira installation in the target directory. If it can't find one, it checks your pom.xml and creates one. If it can find one, it starts it. It does NOT check the version matches your pom.xml.

So, the trick here is to run "atlas-clean" before running it again. That will scrub the target directory and force a rebuild with the correct version.

Try that, and then we can come back to the code if it's a problem.

I ran atlas-clean and now it doesn't work at all. I get a compilation failure saying a lot of packages don't exist.

error: package com.atlassian.jira.plugin.issuetabpanel does not exist

I am wondering if you have to be in the right directory in order to run this, and maybe I have it wrong!

I suspect it's your attempts to get the dependencies right while the wrong Jira was in place.

Also, that could be down to your code, but that could be down to your coding tool or libraries.

I'd be tempted to start clean with a new plugin directory - but change the pom.xml before the first time you run atlas-run/package etc

I've tried three times this morning to start from scratch and get it working again. The first two times I just deleted the plugin directory, the last time I uninstalled then reinstalled the SDK and restarted my machine as well.

I changed the pom.xml, then ran the altas-debug the first time. However, I then found that I hit the problem with the missing jars (see above), so I had to insert the exclusions into the XML.

However, it still does not work and I get a build failure.
Each time I get the errors:

error: package com.atlassian.jira.plugin.issuetabpanel does not exist

etc etc (see below).

C:\Users\paul\atlassian-plugin-sdk\tabpanel\src\main\java\com\stygian\jira\pl
ugins\panels\DemoIssueTabPanel.java:[5,46] error: package com.atlassian.jira.plu
gin.issuetabpanel does not exist

C:\Users\paul\atlassian-plugin-sdk\tabpanel\src\main\java\com\stygian\jira\pl
ugins\panels\DemoIssueTabPanel.java:[6,46] error: package com.atlassian.jira.plu
gin.issuetabpanel does not exist

C:\Users\paul\atlassian-plugin-sdk\tabpanel\src\main\java\com\stygian\jira\pl
ugins\panels\DemoIssueTabPanel.java:[7,41] error: package com.atlassian.jira.iss
ue.tabpanels does not exist

C:\Users\paul\atlassian-plugin-sdk\tabpanel\src\main\java\com\stygian\jira\pl
ugins\panels\DemoIssueTabPanel.java:[12,0] error: com.opensymphony.user.User is
already defined in a single-type import

C:\Users\paul\atlassian-plugin-sdk\tabpanel\src\main\java\com\stygian\jira\pl
ugins\panels\DemoIssueTabPanel.java:[14,39] error: cannot find symbol

could not parse error message:   symbol: class AbstractIssueTabPanel
C:\Users\paul\atlassian-plugin-sdk\tabpanel\src\main\java\com\stygian\jira\pl
ugins\panels\DemoIssueTabPanel.java:14: error: cannot find symbol
public class DemoIssueTabPanel extends AbstractIssueTabPanel implements IssueTab
Panel
                                                                        ^

could not parse error message:   symbol: class IssueTabPanel
C:\Users\paul\atlassian-plugin-sdk\tabpanel\src\main\java\com\stygian\jira\pl
ugins\panels\DemoIssueTabPanel.java:22: error: cannot find symbol
                return Collections.singletonList(new GenericMessageAction(string
Builder.toString()));

Did you remove all the attempts to get this to work from the pom.xml and code? You've mentioned cleaning out various things, but have you returned to the original code that you got from the tutorial originally? And was that code for version 4 of Jira to begin with (A lot of plugin code for v4 won't work with v6 and vice-versa)

Yes I deleted everything, including the whole plugin folder. I even tried deleting the whole SDK and re-installing it. I am not sure if the code is for version 4 - the code is just what you get when you follow the instructions in the tutorial. The class implements IssueTabPanel and this suggests that it works with older versions:

https://developer.atlassian.com/static/javadoc/jira/5.0.5/reference/com/atlassian/jira/plugin/issuetabpanel/IssueTabPanel.html

Ok, then I suspect the tuturial code you have is simply unsuitable for version 4. It looks like a more recent version is targetted.

The messages you are getting imply you might have got the class names wrong in your code, there's a reference to "user" in there which could be a huge problem depending on what the code was written for vs your 4.x target, and so on.

https://confluence.atlassian.com/display/JIRA041/Issue+Tab+Panel+Plugin+Module gives you a basic descriptor which is a good starting point. If it's not too sensitive, I'd suggest you post your Java code for the main class here as well - the imports and main functions look like the problem (business logic comes later)

package com.stygian.jira.plugins.panels;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.atlassian.jira.plugin.issuetabpanel.AbstractIssueTabPanel;
import com.atlassian.jira.plugin.issuetabpanel.IssueTabPanel;
import com.atlassian.jira.issue.tabpanels.GenericMessageAction;
import com.atlassian.jira.issue.Issue;
import com.opensymphony.user.User;
import java.util.Collections;
import java.util.List;
import com.atlassian.crowd.embedded.api.User;

public class DemoIssueTabPanel extends AbstractIssueTabPanel implements IssueTabPanel
{
    private static final Logger log = LoggerFactory.getLogger(DemoIssueTabPanel.class);

    public List getActions(Issue issue, User remoteUser) {
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.append("&lt;h1&gt;Issue tab panel content&lt;/h1&gt;");
		stringBuilder.append("You can generate your html content here to display.");
		return Collections.singletonList(new GenericMessageAction(stringBuilder.toString()));
    }

    public boolean showPanel(Issue issue, User remoteUser)
    {
        return true;
    }
}

I've tried removing the slf4j importas and getting rid of the Log and that doesn't work either.

This widget could not be displayed.

I suppose the real goal is working out how to to get a tab on the issue panel in our Jira (v4). But if I can't even get a simple "hello world" example working after days of effort, then it doesn't look good.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Friday in Jira

New 5k User Limit and Other Cloud Updates

Hi all! Lauren here from the Enterprise Cloud marketing team.  I have some exciting Cloud updates from #AtlassianSummit that I wanted to share. We want everyone in your organization to be ab...

119 views 0 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you