Making Pentaho Development Easier with Eclipse Build Natures

Typically, when you set up a Java project in Eclipse, the Eclipse IDE adds a default Java Build Nature, and the project is configured for default automatic building. Eclipse though is capable of incorporating multiple build natures. Please see the Eclipse Article on Natures for more information about build natures as a technology. This article is focused on utilizing this capability in Pentaho projects to make the development process easier.

Prerequisites

The screen shot attached to this article is from Eclipse 3.2.2. This capability has been in Eclipse since Eclipse 3.0. Versions of Eclipse other than 3.2.2 may have different ways to define a new build nature. It is also assumed that a project has been downloaded from subversion into Eclipse.

Instructions

  1. Right-click on the project in Eclipse and choose Properties on the context menu.
  2. In the left panel, select Builders.
  3. In the right-panel, select New...
  4. Select Ant Build and click the OK button
  5. Fill out the tabbed dialog with information as follows:
    • Name Field - set the name to something meaningful. I suggest, when the project has the common_build.xml, using the name Common Ant Builder. Otherwise, you may wish a name that reflects the project like "API Ant Builder".
    • Main Tab
      • You can select the build file using Browse Workspace, but what gets put in is a hard-coded file reference. Instead, it's better to use variables and set it manually. This is important if the file will be checked into SVN. As an example, use ${project_loc}/common_build.xml or ${project_loc}/build.xml if there's no common_build.xml.
      • In the Base Directory field, instead of the hard-coded project location, change the field to say ${project_loc}.
    • Refresh Tab
      • Select the check-box "Refresh resources upon completion."
      • Select the "The project containing the selected resource
    • Targets Tab
      • For the After a "Clean" box, choose the publish-local target.
      • For the Manual Build box, choose the publish-local target
      • For the During a Clean box, choose the clean-dist and clean-jars targets

Launch Configuration Properties - Main Tab

Launch Configuration Properties - Refresh Tab

Launch Configuration Properties - Targets Tab

Results

If this was successful, you should see a new folder in your project called .externalToolBuilders with one file in it. The file will be named according to what you chose above as the name of the builder. To test that things work for you, you can clean an individual project, and you should also see the Ant script execute the target specified.

Troubleshooting

  1. In Eclipse 3.2.2, I notice that the "Build" operation for manually building doesn't predictably execute the Ant task. Clean always works.

Related Items

  • Soon, all the bi-platform-* projects will be updated to utilize this capability automatically. So, you won't have to do this manually.
  • This technique isn't only useful in projects where we have Ivy - it's useful everywhere that Eclipse builds one kind of artifact, and Ant build scripts are used to build other artifacts.