Groovy Examples

Go to list of examples

Use External JAR Library with Groovy IDE

Use External JAR Library with Groovy IDE

In Cloud Integration Flow editor, you can upload JAR files and they will be available for your Groovy scripts.

To use JAR files with Groovy IDE Desktop edition, you can add special comments at the start of the script. Since these are just comment lines, it doesn't affect your Flows.

//${Location of Jar file}

Then, you can import Java classes as usual.


Try it on Groovy IDE
// These lines are ignored in Cloud Integration runtime:


//imports will not give error:
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.type.CollectionType;


def Message processData(Message message) {
	return message;