Upgrading from 1.x to 2.x
This document is intended for JMCF users who are migrating from version 1.7 to version 2.x. JMCF has moved from BeanShell Scripting to Groovy, and also has a vast number of advanced features and new custom fields to offer. Though the migration is pretty straightforward there are certain things that you need to be aware of.
On this page:
Configuration storage changes
In JMCF 1.7, calculated custom field configuration was stored as HTML comments inside the field's Description, which can be seen on the custom field's Edit screen.
Starting with JMCF 2.0.0, calculated custom field configuration is now stored in its own database tables inside the Jira database (using Atlassian Active Objects), and edited on the custom field's Configure screen. This means that the HTML comments inside the field's Description are now ignored.
Automatic migration when upgrading to 2.x
When you upgrade to JMCF 2.x for the first time, an automatic upgrade task is run to convert:
- Transition names or IDs provided under
@Transition Id
or@TransitionName
HTML comments to theTransition(s) to look for
custom field configuration option - Transition execution details provided under an
@Execution
HTML comment to theTransition Execution
custom field configuration option - Formats provided under an
@@Format
HTML comment to theDate Format
custom field configuration option - Formats provided under an
@@ColFormat
HTML comment to theDate Column Format
custom field configuration option - Field names provided under an
@@Field
HTML comment to theField to look for
custom field configuration option
All corresponding HTML comments are modified to include the following warning: WARNING: ignored in JMCF 2.x. Edit the field's Configuration instead.
Once you are certain you will not be downgrading to JMCF 1.7 (see Reverting to JMCF 1.7 below), you can safely remove the HTML comments from the custom field Description.
Note that BeanShell formulas in @@Format
HTML comments of the Calculated Number custom field type and @@Formula
HTML comments of any applicable calculated custom field type are not converted automatically. See the next section for details.
Migrating from BeanShell to Groovy
BeanShell scripts inside the field's Description will continue to be used, and will be evaluated using the BeanShell scripting engine, until you edit and save them on the custom field's Configure screen. Once they are saved on that screen, they will replace the corresponding script from the field's Description, and will from now on be evaluated using the Groovy scripting engine.
To convert a BeanShell script to Groovy:
- Locate the custom field on the Custom Fields administration page.
- Click on the cog wheel and click on
Configure
- Click on
Edit Groovy Formula
orEdit Format Expression.
- The Formula under the
@@Formula
HTML comments will be copied to theGroovy formula
custom field configuration option. - Click on
Save.
When you save the Groovy formula
or Format Expression
:
- The script will be converted to the Groovy language and will be stored, upon saving, outside of the field's Description.
- The HTML comment containing BeanShell script in the field's Description will be modified to include the following warning:
WARNING: ignored in JMCF 2.x. Edit the field's Configuration instead.
While Groovy is generally compatible with the BeanShell language, some scripts might need to be adjusted. Here are the main syntax differences that you will need to take into account, although it is very unlikely that you will encounter them in your scripts.
We strongly encourage you to test your script before saving, using the "Test groovy script" button at the top of the editor.
Description | Example | Replace with |
---|---|---|
You can define a method implicitly in BeanShell. But the Groovy interpreter considers it as a Closure. | For example: add( int a, int b ) { return a + b; } foo = add(1, 2); return foo; // 3 returns a compilation error | You need to define the method explicitly as: def add( int a, int b ) { return a + b; } foo = add(1, 2); return foo; returns 3 |
Unsupported commands - unset(), invoke() | int a; a == void; // true a=5; unset("a"); // note the quotes a == void; returns a def invoke( String methodName, Object [] arguments ) { "You invoked the method: "+ methodName; } //invoke() will be called to handle noSuchMethod() noSuchMethod("foo"); returns a | No equivalent exists in Groovy. |
Reverting to JMCF 1.7
We have conducted extensive tests to make sure that existing JMCF 1.7 configurations will continue to work after upgrading to JMCF 2. However, due to the large variety of use cases, you might still encounter an issue after upgrading to JMCF 2. If that happens, you can revert to JMCF 1.7 using the following steps:
Log in to Jira as an administrator.
Click on the Administration icon . Navigate to Add-ons > Manage Add-ons.
- Under User-Installed Add-ons, search for Jira Misc Custom Fields and click on it.
- Click on Uninstall.
- Download version 1.7.2 of JMCF from this link
- Click on and upload the jar file.
Note that JMCF 1.7.2 will revert to the Description-based configuration and thus ignore any change you might have made on custom field Configure screens.
Naturally, we would love to hear about any issue you encounter after the upgrade. Please reach out to our Support team so we can help you take advantage of all the new features JMCF 2 has to offer!