Contact Xavor

Xavor Corporation
8925 Research Drive
Irvine, California 92618
Toll-Free: 800-949-5719
Direct: 949-529-7372

Groovy Script


Groovy Script

Eclipse is one the most commonly used IDE (Integrated Development Environment) by Java developers worldwide. Using an IDE greatly improves development effort. Some of major benefits of using an IDE include:

  • Code Completion
  • Syntax Checking
  • Refactoring
  • Highlighting
  • Integration with source control

Eclipse does not natively support Groovy but there are plugins available that can be used for this purpose.

Before we begin, let me clarify using an IDE is optional and we can always write the code directly into the Event Handler window and Agile PLM will check for syntax and compile time errors for us. But this way, we won’t be able to make use of the features mentioned earlier.


Installing Groovy-Eclipse Plugin

First step is to download the Groovy plugin for eclipse.

The plugin we are going to use for this is Groovy-Eclipse available at:

URLs for releases of specific Eclipse are on the wiki page:

Copy the URL for version of Eclipse you have. Then launch Eclipse, click on Help and select Install New Software.


Paste the URL in the Work with and hit enter. Eclipse will pull the available installations.


For this case, we are going to install Groovy-Eclipse Feature and Groovy Compiler Feature.

Note: As of now Agile PLM supports Groovy 1.5.6 so any of the later compilers can work. The compiler feature for versions earlier than 1.8 is not available.


After making the selection, click next. Go through to the terms and conditions and hit finish to install.

Once installed, Eclipse will restart automatically.


Creating a Groovy Project

Now that we have the plugin installed, let’s go ahead and create a Groovy project.

To do this, go to File menu, select New and then Other from the options available.


On the New dialog, search for and select Groovy Project and then click Next.


Give the project a name and click finish.


Eclipse will create the Project for us. But before we can start writing code for our process extension, we have to include relevant libraries into our project.

The libraries we are going to need are the following. They come with the installation of Agile PLM.

  • AgileAPI.jar
  • agileclasses.jar

To do this, right click the Project and select Properties. In the Project Properties, select Java Build Path and go to Libraries tab. Click on Add External JARs and select AgileAPI.jar and agileclasses.jar. Click OK once done.


Now we are going to add a class for Groovy. To do that right click the src folder. Select New and Other.


In the New wizard search for and select Groovy Class and click Next.


In create new class window, enter a name for the package and class. Then click finish.


Eclipse will create the class. Edit it and add the following started code and import statement.

package com.xavor.groovyproject
import com.agile.agileDSL.ScriptObj.IBaseScriptObj
class GroovyClass {


void invokeScript(IBaseScriptObj obj) {




Once we do that we can go ahead and start implementing. Eclipse will help with the code completion.

Please note that since Groovy is a dynamically type language and we can’t be certain of an object type at compile time, you might have to use variable declaration to make use of IntelliSense.

After the code is written, the last step is to copy it to the event handler in Java client.



To learn more, I invite you to Contact Us Today as well as view our Groovy Script webinar here.

Author: Usman Ilyas
As Xavor’s Agile PLM Technical Consultant, Usman Ilyas has been working with Xavor for the past 7 years. He has been focused on working with customers within the high-tech and medical device industry.

Comments are closed.