Move custom field definition from pluginA to pluginB

We have many packages with dependencies on each other. But we want to move towards fewer plugins. In this case, plugin-core is used by plugin-1. In the plugin-1 atlassian-plugin.xml, we have a custom field definition

    <customfield-type name="My Custom Field"
                      key="plugin1.mycustomfield" 
                      class="com.company.plugin1.customfield.MyCustomField">
    </customfield-type>

we would like to move that custom field to package-core.

We’re concerned about the pains, bugs, etc. it might cause to our customers.

Is moving a custom field definition from one package to another supported/feasible at all ?

Thank you for your advice.

Hi @LudovicCleroux,

I would not recommend moving such elements as it can cause a lot of problems with existing installations. Plugin dependencies are pretty easy once you have a good understanding of it - though, I try to keep “pure” plugins wherever possible.

What will happen if you move your definitions (e.g. customfields) from plugin-1 to plugin-core?

  • Your app key will change.
  • Your java package name might change

Existing usages of customfields will no longer be possible. At minimum, you will need to write some upgrade task(s) to fix the inconsistencies, e.g. as described here: Writing a plugin upgrade task to migrate user data to new user keys

Would I recommend doing so? Absolutely not. Assume that a customer installs the new version, but your upgrade task runs into some problem and cannot convert existing customfields? The customfield will no longer be usable until rolling back the installed plugin. A customer might run into a situation in which his application is no longer usable. What happens if - for some reason - you’ve converted 1/3 of all customfields, but the remaining 2/3 customfields are still referencing the old classes and keys? In such a scenario a customer will have to manually fix the database or most likely rollback to a known good state from a backup.

But possibly, someone has more experience with these dangerous operations and can share their opinion on that.