Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This document is intended to for JMCF add-on users that who are migrating from version 1.x 7 to version 2.x. JMCF has moved from BeanShell Scripting to Groovy from 2.x. It , 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 should be taken care of after migrationyou need to be aware of.

On this page:

Table of Contents

During the migration from 1.x to 2.x

An

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 copy convert:

  • Transition names or IDs provided under @Transition Id or @TransitionName tags  HTML comments to the Transition(s) to look forfield of the custom  custom field configuration option
  • Transition execution details provided under @Execution to  to the Transition Execution field of the custom  custom field configuration option
  • Format Formats provided under @@Format to the @@Format tag to Date Format field of the custom  custom field configuration optionFormat
  • Formats provided under the @@ColFormat tag to under @@ColFormat to the Date Column Format field of the custom  custom field configuration option
  • Field name names provided under @@Field tag to  to the Field to look for field of the custom  custom field configuration

and all the above-mentioned tags are commented with a warning and are ignored in 2.x.

Post-migration from 1.x to 2.x

Note

It is suggested to perform a non-regression testing before starting to take advantage of the new features in the add-on. 

...

  • 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 @@Formula@@Format and @@ColFormat HTML comments are not converted automatically. See the next section for details.

Migrating from BeanShell to Groovy

BeanShell scripts inside the field's Description use the legacy script as long as you don't save the new configuration. To save the new configuration;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:

  1. Locate the custom field on the Custom Fields administration page.
  2. Click on the cog wheel and click on Configure
  3. Click on Edit Groovy Formula/Edit Format Expression.
  4. The Formula under the @@Formula tag will be copied to the Groovy formula.
  5. Click on Save.

When you save the Groovy formula or Format Expression:

  1. The script will be converted to the Groovy language and will be stored, upon saving, outside of the field's Description. 
  2. The BeanShell scripts are commented with a warning and ignored in 2.xHTML 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 a few syntaxes of BeanShell scripts the main syntax differences that you might want to modify to make them Groovy compatible. We 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.

DescriptionExampleReplace with
You can define a method implicitly in BeanShell. But the Groovy interpreter considers it as a Closure.

For example:

Code Block
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:

Code Block
def add( int a, int b ) {
return a + b;
}
foo = add(1, 2);
return foo; 

returns 3

Unsupported commands -  unset(), invoke()


Code Block
int a;
a == void; // true
a=5;
unset("a"); // note the quotes
a == void;

returns a MissingMethodException


Code Block
def invoke( String methodName, Object [] arguments ) { 
	"You invoked the method: "+ methodName; 
} //invoke() will be called to handle noSuchMethod() 
noSuchMethod("foo");

returns a MissingMethodException

No equivalent exists in Groovy.

Anchor
revert
revert
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.2 using the following steps:

  1. Go to the Manage apps admin page
  2. Uninstall JMCF 2
  3. Download version 1.7.2 of JMCF from this link
  4. Click on the Upload add-on link to upload the file downloaded in step 3

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.