I want to run some code before upgrade. Is there a way to intercept plugin upgrade, run custom code and then resume upgrade.
JIRA converts components into spring beans internally.
Create a Component Plugin module that implements InitializingBean and DisposableBean. When the plugin will be installed/enabled/upgraded then afterPropertiesSet method will be invoked and when plugin will be disabled/uninstalled then the destroy method will be invoked.
So, If you are upgrading a new plugin then afterPropertiesSet method will be invoked on new plugin and destroy will be invoked on old plugin.