To edit or add content to this Wiki, you can simply create a new account at

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

WOLips encapsulates the functionality of EOGenerator so that the Java classes can be generated from within Eclipse. WOLips can create an .eogen definition for you when the model is created or you can create one after the model has been created by going to File - New - Other... and selecting EOGenerator. If you already have an EOModel file, you can bypass the .eogen file creation by right-clicking on your EOModel in WOLips and selecting WOLips Tools=>Create EOGenerator File.

Install and Configure EOGenerator

Before you can generate Java classes you will need to download (from and install EOGenerator. EOGenerator is not part of Eclipse or WOLips. It is a command line tool which needs a number of parameters/preferences to run. Do not use EOGenerator's instructions for installation as an Eclipse builder. EOGenerator is run using a WOLips configuration. After it is installed, tell Eclipse/WOLips where it is in preferences:

Setup Configuration for a Model

The next step is to fill in the .eogen configuration for your model.

Multiple Models

If you have multiple models that you need to generate Java classes for, and they need different settings (templates, destination directories etc), each of these will need its own .eogen configuration.

Double click on the <ModelName>.eogen icon in the Package Explorer or Navigator:

The top section of the editor looks like this:

Set the model(s) to generate Java for in the first area. In the second include models containing prototypes and models that are referenced by the models in the first group, but which should not have Java generated for the entities in them.

The File Names settings can be ignored unless you need to generate oddly formed file names. You will usually want to Create Packages (place the generated files in a directory corresponding to their package). It can useful to have different Destination and Subclass Destination directories. The totally generated classes in the Destination directory are not very interesting and can be tucked away out of sight.

The Templates determine how the Java code is generated. The setting should be self explanatory. The Defines are useful for extending the templates with custom values.

Generate the Classes

To generate the Java classes, simply right (control) click on the .eogen configuration and select EOGenerate... from the context menu. A dialog window will be shown when EOGenerator finishes so that you can verify what it did.

EOGenerator Not Running?

Nothing happens? Just see a flicker of a progress bar at the bottom right? Go back to the Preferences. The path to the eogenerator executable is missing or incorrect.

Ant generation

Manually generating your files can, of course, get a little boring after a while. You may prefer the generation to happen in the background via ant (for example when you save changes to your model). This is especially useful for automated build environments.

Create a target in your build.xml called "init.eogenerator" like the following:

<target name="init.eogenerator">
	<exec executable="/usr/bin/env" dir="${basedir}">
		<arg value="perl" />
		<arg value="${basedir}/etc/" />

If ant supported loops by default we wouldn't need an additional script, but because we want to find all *.eogen files in our Resources directory and execute them one by one we can use perl and call it from ant. Create a file yourprojectdir/etc/ as follows:

#!/usr/bin/env perl

use strict;
use warnings;

my $RESOURCES = "Resources";

if ( -d $RESOURCES ) {
    opendir(DIR, $RESOURCES) || die "can't open $RESOURCES: $!";
    my @files = grep { ! /^\./ && -f "$RESOURCES/$_" && /\.eogen$/ } readdir(DIR);
    closedir DIR;
    foreach (@files) {
        my @args = ("./$RESOURCES/$_");

Lastly, adjust your compile target from

<target name="compile" depends="setProps,"> ... </target>


<target name="compile" depends="setProps,init.eogenerator,"> ... </target>
  • No labels