Hi,
I am writing a Jira server plugin where I have a requirement to do a particular execution while plugin is installing. I have used PluginUpgradeTask concept, but this is not being executed on plugin deployment. Below is my code.
I am unsure what mistake am I doing.
public abstract class AbstractUpgradeTask implements PluginUpgradeTask{
@Override
public String getPluginKey() {
Bundle bundle = FrameworkUtil.getBundle(AbstractUpgradeTask.class);
return OsgiHeaderUtil.getPluginKey(bundle);
}
}
@Component
@ExportAsService(PluginUpgradeTask.class)
public class LoadConfig extends AbstractUpgradeTask {
@ComponentImport
private final PluginSettingsFactory pluginSettingsFactory;
@Autowired
public LoadConfig(PluginSettingsFactory pluginSettingsFactory) {
this.pluginSettingsFactory = pluginSettingsFactory;
}
@Override
public Collection<Message> doUpgrade() throws Exception {
System.out.println("=============================================> "+doUpgrade);
log.warn("doUpgrade");
}
@Override
public int getBuildNumber() {
// TODO Auto-generated method stub
return 1;
}
@Override
public String getPluginKey() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getShortDescription() {
return "This upgrade task";
}
}
Best Regards,
Kumar
Hi @KL Kumar
It seems you're not returning anything from the getPluginKey() method. As the SAL tracks successful upgrades, at a minimum it will need to to know both the plugin key and build number.
I'd also recommend continuing this discussion on the Developer Community (https://community.developer.atlassian.com/) where they'll be better able to assist with queries such as this.
I tried returning the plugin key for getPluginKey() method. But no luck.
I raised this in developer community too and waiting for some help from the community.
Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@KL Kumar I was taking a look around and found this answer in another thread about plugin upgrades.
It points to a Git repo with examples, maybe it'll give you some insight.
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.