Wednesday, October 22, 2014

Using IntelliJ IDEA as development tool for ODI Groovy scripts

I find the Groovy editor in ODI quite limiting when editing my scripts. I know there must be a multitude of IDE’s which are suitable for editing Groovy but I found InteliJ IDEA on Google and liked the look and feel of the tool, so I wondered if I could use it to make editing ODi Groovy scripts easier.

Download the IntelliJ IDEA Community Edition which is free from the following link and install.

Start InitelliJ IDEA:

2014-10-21 07_31_55-IntelliJ IDEA

Select Project structure  so we can setup the defaults for our ODI Groovy projects. The first thing we have to define is the SDK. Select Project on the left and create the New button to create a new SDK and select JDK. In the select window that follows select the home folder of the SDK you use to run ODI. I use jdk1.7.0_45 because I now this works for ODI 12.1.3, I have had some issues with other patch levels.

2014-10-21 07_33_15-Project Structure

Next we need to setup the ODI Libraries. Click Libraries on the left and then click the green + sign at the top of the empty box. Again a select window will open where you can add the library paths by clicking the green +. At the top you can enter a name for the Library, I chose odilib. Add the following paths to the library (the version numbers might vary):

  • %ODI_HOME%\odi\sdk\lib
  • %ODI_HOME%\oracle_common\modules\oracle.jdbc_12.1.0
  • %ODI_HOME%\oracle_common\modules\oracle.jsf_2.1

2014-10-22 00_01_08-Project Structure

Now setup is complete and we can start creating projects. Make sure to select Groovy for the language, the Groove library can remain empty, then finish creating the project.

2014-10-22 01_30_13-New Project

I have chosen to create a module for each of my scripting sub-projects, you can choose to organize your projects any way you want, but this works for me. Create a new Module by right clicking on the project name and then selecting New->Module. The New Module dialog appears and again choose Groovy as your language and select the Groovy Library we defined before (in my case odilib). Finish creating the Module.

2014-10-22 00_25_38-New Module

Within a Module we can create several types of source files, but for scripting I use a Groovy Script type. To create it right-click the module name and select New->Groovy Script. This will open an editing window for your new script.

2014-10-22 00_26_40-Program Manager

These are the features of IntelliJ IDEA I particularly like:

  • The out of the box support for Groovy
  • Code->Reformat Code
  • Code->Optimize Imports
  • The automatic import of classes
  • The very helpful information the editor gives when writing code
  • Version control
  • and many, many more…

Of course there are many IDE’s which have similar functionality. You will just have to use the one that works best for you.

No comments:

Post a Comment