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

Add JIRA dependency to Atlassian SDK plugin

AndrewB January 11, 2016

I'm attempting to build a plugin.

I created the plugin skeleton, created a web-item, and a web-work. I added a log statement in the web-work's execute method, andt hen tried to run atlas-run in my plugin directory. When it's building I got the error .../webwork/StatusRefreshWebWorkAction.java:[5,37] package com.atlassian.jira.web.action does not exist.

So I found something online that suggested adding JIRA as a Maven dependency. I'm pretty certain this is my issue. But, I'm getting errors when trying to add this dependency.

 

I tried adding:

<dependency>
	<groupId>com.atlassian.jira</groupId>
	<artifactId>jira-api</artifactId>
	<version>${jira.version}</version>
	<scope>provided</scope>
</dependency>
<dependency>
	<groupId>com.atlassian.jira</groupId>
	<artifactId>jira-core</artifactId>
	<version>${jira.version}</version>
	<scope>provided</scope>
</dependency>

 

And then:

<dependency>
    <groupId>com.atlassian.jira</groupId>
    <artifactId>atlassian-jira</artifactId>
    <version>${jira.version}</version>
    <scope>provided</scope>
</dependency>
but am getting errors when running both atlas-mvn and atlas-clean: ...'dependencies.dependency.version' for com.atlassian.jira:atlassian-jira:jar must be a valid version but is '${jira.version}'...
How do I resolve this issue w/ the jira.version in the Maven POM.xml dependency? Is this why I am getting package does not exist issues? Also, how can I make my plugin & Maven both use the same version & have that version be the same as the JIRA system's version that I'm making the plugin for? Thank you for any help!

3 answers

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
AndrewB January 13, 2016

OK so the underlying problem was that I already had a Maven settings.xml file on my system that was used when I created the plugin.

 

I added the info from the Maven settings.xml that came w/ the Atlassian SDK & put them into my system's Maven settings.xml file. Then I re-created my plugin and the pom.xml was generated with the correct information.

1 vote
Jobin Kuruvilla [Adaptavist]
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.
January 11, 2016

atlassian-jira dependency won't work. You need only jira-api dependency for webwork actions, unless you are using some core classes in the code. In that case, use jira-core dependency as well.

Make sure you rebuild the project for your IDE and refresh the same in the IDE.

Jobin Kuruvilla [Adaptavist]
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.
January 11, 2016

Forgot to mention that pom.xml should be updated to reflect the version of JIRA you are developing for!

0 votes
AndrewB January 12, 2016

@Jobin Kuruvilla [Go2Group] thanks for the response.

 

I do plan on using some core classes in the code. I changed the pom.xml back to using the dependencies:

<dependency>
    <groupId>com.atlassian.jira</groupId>
    <artifactId>jira-api</artifactId>
    <version>${jira.version}</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>com.atlassian.jira</groupId>
    <artifactId>jira-core</artifactId>
    <version>${jira.version}</version>
    <scope>provided</scope>
</dependency>

 

I'm not using an IDE at the moment. When trying to run I get the following error, the same as before:

 

C:\Users\ANDY_BOUTIN\Desktop\atlassian-workspace\statusrefreshbutton>atlas-run
Executing: "C:\Applications\Atlassian\atlassian-plugin-sdk-6.2.2\apache-maven-3.
2.1\bin\mvn.bat" com.atlassian.maven.plugins:maven-amps-dispatcher-plugin:"6.2.1
":run -gs C:\Applications\Atlassian\atlassian-plugin-sdk-6.2.2\apache-maven-3.2.
1/conf/settings.xml
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256M; sup
port was removed in 8.0
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.custom:statusrefreshbutton:1.0-SNAPSHOT (C:\Users\ANDY
_BOUTIN\Desktop\atlassian-workspace\statusrefreshbutton\pom.xml) has 2 errors
[ERROR] 'dependencies.dependency.version' for com.atlassian.jira:jira-api:ja
r must be a valid version but is '${jira.version}'. @ line 19, column 14
[ERROR] 'dependencies.dependency.version' for com.atlassian.jira:jira-core:j
ar must be a valid version but is '${jira.version}'. @ line 25, column 14
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildin
gException
C:\Users\ANDY_BOUTIN\Desktop\atlassian-workspace\statusrefreshbutton>

 

You said to make sure that I update the pom.xml to the version of JIRA that I'm using. Where exactly do I update that? Am I supposed to replace ${jira.version} w/ my JIRA version or am I supposed to have a variable jira.version defined somewhere?

Jobin Kuruvilla [Adaptavist]
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.
January 12, 2016

Yes, you need to have it under properties. <properties> ... <jira.version>7.0.0</jira.version> .... </properties>

AndrewB January 12, 2016

For some reason mine was named platform.version - I changed all occurrences of it to jira.version - thank you. I also needed to update my existing settings.xml file w/ the required info for using the atlassian SDK since I already had Maven on my system & it was defaulting to the already installed one. Thanks for the help, slowly getting there.

TAGS
AUG Leaders

Atlassian Community Events