ConfiguringAntBuildFiles

From Protege Wiki

Revision as of 12:40, March 7, 2009 by Tredmond (Talk | contribs)

Jump to: navigation, search

Using and Configuring Protege Ant Build Scripts

There is a standard format for the protege ant build scripts. The main idea behind these build scripts is that most of the dependencies needed by a plugin project can be found inside a protege distribution. Therefore the build file uses the PROTEGE_HOME environment variable to point to a Protege distribution and find the dependencies from there. This removes the problems where users commit jar files from the protege distribution and have to keep updating them.

So the simplest way of configuring the invocation of an ant build script is to set the PROTEGE_HOME environment variable. The way that this is done is system dependent:

  • On unix systems from the command line use "export PROTEGE_HOME=/home/tredmond/Desktop/Protege". This command can also be put in a .bashrc file. On the command line, unix systems also allow one to set a property for the duration of one command as follows
                    PROTEGE_HOME= /home/tredmond/Desktop/Protege" ant install
  • OS x machines are unix machines so all the unix techniques apply. However, in addition to this there is the
                 ~/.MacOSX/environment.plist

    file which contains a set of properties. The advantage of using this file is that it is invoked before applications that are invoked with a double click. There is a nice page about this here. So it might make sense to put environment property values in here that are seen by an IDE which is started with a double click.
  • On windows systems, right click on MyComputer and select settings. Then find Environment Variables and click then locate PROTEGE_HOME, press edit and change to the path to protege.
  • In eclipse follows these directions and then go to the environment settings page and add the environment setting.

In addition to the above, any variable in a Protege ant script can be configured by setting the value in a local.properties file. This is useful for an installation into a non-Protege application such as a tomcat web server.

Finally, for developers making install scripts, the ant target allows the developer to set variables in the called ant script as parameters. So for instance the place to install protege can be set in the ant script as follows:

        <ant antfile="...">
            <property name="protege.home" location="./build/Protege_4.0_NCI"/>
            ...

This is a very flexible technique and can be used to override any variables in the called ant script. This type of technique is being used at NCI to create custom builds of the NCI Protege in a controlled and consistent fashion.

Personal tools