Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to use PluginUpgradeTask or what should I use instead?

I'm trying to perform certain actions after plugin is installed. I'm familiar with ActiveObjectsUpgradeTask, but since this action has nothing to do with database I'm looking for a more elegant solution. I found an article regarding PluginUpgradeTask, but it's heavily outdated - when I try to use component element in atlassian-plugin.xml, I'm getting following error:

atlassian-plugin.xml contains a definition of component. This is not allowed when Atlassian-Plugin-Key is set.

Linked help document describes that I shouldn't be using component element and use @Component annotation instead. This of course doesn't work.

 

How do I make PluginUpgradeTask work OR what should I use instead to perform actions right after my plugin is installed?

 

2 answers

1 accepted

0 votes
Answer accepted

Turns out I didn't implement all methods from PluginUpgradeTask interface and when my IDE suggested I make my class abstract I accidentally clicked this option. I figured it out when I defined my upgrade task explicitly in spring context file and spring thrown an error. Removing abstract keyword from class declaration solved it.

 

So to sum up, all you really need to run upgrade task is to implement PluginUpgradeTask interface and annotate your class declaration with

@ExportAsService(PluginUpgradeTask.class)
@Component

 You don't need ExportPackage entry in pom.xml

@Herpen Derpen ,

Great you found what you needed!

Usually when people are looking for learning how to develop an app I recommend this open source : https://github.com/atlascommunity/jira-plugins-groovy of MyGroovy app

This repository has a lot of useful tips, 

an example of upgrade task implementation:

https://github.com/atlascommunity/jira-plugins-groovy/blob/jira8/src/main/java/ru/mail/jira/plugins/groovy/impl/upgrade/Upgrade001CreateAuditLogIssueRelation.java

How you can handle your plugin lifecycle (Start/Stop...):

https://github.com/atlascommunity/jira-plugins-groovy/blob/jira8/src/main/java/ru/mail/jira/plugins/groovy/impl/PluginLauncherImpl.java

Probably there are others source codes you can look and learn from, but this is a complete and well written example.

@Herpen Derpen ,

I would say you need to look in the Lifecycle https://developer.atlassian.com/server/jira/platform/plugins2-add-ons/#jira-add-on-lifecycle

I recommend you to continue this question using the Development community. there they will be able to better assist you with your query

https://community.developer.atlassian.com/

Thanks for the tip regarding dev community, I didn't even know it exists.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

JSM June Challenge #2: Share how your business teams became ITSM rockstars

For JSM June Challenge #2, share how your non-technical teams like HR, legal, marketing, finance, and beyond started using Jira Service Management! Tell us: Did they ask to start using it or...

326 views 9 7
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you