CPI Groovy Examples

Go to List of Examples

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.

//groovyide.com:jar:file:${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;

import com.sap.gateway.ip.core.customdev.util.Message;

def Message processData(Message message) {
	return message;