ConfiguringAntBuildFiles

From Protege Wiki
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, the ant runnable configuration has a section which allows you to control the environment variables that the ant script sees.

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. This technique is also being used by the Protege 4 composite projects to make it easy to build and debug various customized Protege 4 installations.

How the Protege ant scripts work

The philosophy of the Protege build scripts is to use the PROTEGE_HOME environment variable as a pointer to the Protege installation directory and as a repository of the latest jars. We will show how this works by demonstrating how to quickly build a Protege 3 installation containing a few basic plugins. This page uses Protege 3 examples but the Protege 4.1 build files work in exactly the same way (except that in that case PROTEGE_HOME must point to a Protege 4.1 installation directory rather than a Protege 3 installation directory).

We will start by creating an empty directory and installing the core Protege 3 implementation into that directory. Please note that this build script was run on a very slow machine and will run much faster on modern platforms.


[tredmond@Andromeda protege-core]$ mkdir /tmp/Protege3
[tredmond@Andromeda protege-core]$ export PROTEGE_HOME=/tmp/Protege3
[tredmond@Andromeda protege-core]$ svn info
Path: .
URL: http://smi-protege/repos/protege/protege-core/trunk
Repository Root: http://smi-protege/repos/protege
Repository UUID: 30a32298-b1ee-0310-87e3-a7336bc3aa68
Revision: 14650
Node Kind: directory
Schedule: normal
Last Changed Author: tredmond
Last Changed Rev: 14624
Last Changed Date: 2009-06-27 11:29:11 -0700 (Sat, 27 Jun 2009)

[tredmond@Andromeda protege-core]$ ant clean
Buildfile: build.xml

clean-clips:

clean:

BUILD SUCCESSFUL
Total time: 1 second
[tredmond@Andromeda protege-core]$ ant install
Buildfile: build.xml

init:

prepare:
    [mkdir] Created dir: /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-core/classes
    [mkdir] Created dir: /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-core/classes.junit
    [mkdir] Created dir: /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-core/dist
    [mkdir] Created dir: /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-core/docs/apidocs

check-clips:

maybe-clean-clips:

clean-clips:

javacc:
   [javacc] Java Compiler Compiler Version 4.0 (Parser Generator)
   [javacc] (type "javacc" with no arguments for help)
   [javacc] Reading from file /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-core/bin/Parser.jj . . .
   [javacc] Warning: Line 4, Column 5: Bad option name "OPTIMIZE_TOKEN_MANAGER".  Option setting will be ignored.
   [javacc] Note: UNICODE_INPUT option is specified. Please make sure you create the parser/lexer using a Reader with the correct character encoding.
   [javacc] File "TokenMgrError.java" does not exist.  Will create one.
   [javacc] File "ParseException.java" does not exist.  Will create one.
   [javacc] File "Token.java" does not exist.  Will create one.
   [javacc] File "SimpleCharStream.java" does not exist.  Will create one.
   [javacc] Parser generated with 0 errors and 1 warnings.

compile:
    [javac] Compiling 891 source files to /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-core/classes
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
     [rmic] RMI Compiling 1 class to /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-core/classes
     [rmic] RMI Compiling 1 class to /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-core/classes
     [rmic] RMI Compiling 1 class to /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-core/classes
     [rmic] RMI Compiling 1 class to /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-core/classes
     [copy] Copying 186 files to /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-core/classes
     [copy] Copied 4 empty directories to 1 empty directory under /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-core/classes

jar:
     [copy] Copying 1 file to /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-core/dist
      [jar] Building jar: /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-core/dist/protege.jar

install:
     [copy] Copying 1 file to /tmp/Protege3
     [copy] Copying 1 file to /tmp/Protege3
     [copy] Copying 1 file to /tmp/Protege3
     [copy] Copying 9 files to /tmp/Protege3
     [copy] Copying 12 files to /tmp/Protege3/examples
    [mkdir] Created dir: /tmp/Protege3/plugins
    [mkdir] Created dir: /tmp/Protege3/logs

BUILD SUCCESSFUL
Total time: 40 seconds
[tredmond@Andromeda protege-core]$ 

At this point you can go to the Protege 3 installation and run it and it will be able to load frames projects. This is the most basic Protege 3 installation. The PROTEGE_HOME environment variable has only been used to determine the location to install Protege. Note that this installation process is portable - it works on any java platform with ant - and it does not depend on any particular directory structure, the existence of any executables (other than ant and java) or the system configuration.

Now we will add owl.


[tredmond@Andromeda protege-owl]$ cd ../protege-owl
[tredmond@Andromeda protege-owl]$ svn info
Path: .
URL: http://smi-protege/repos/protege/owl/trunk
Repository Root: http://smi-protege/repos/protege
Repository UUID: 30a32298-b1ee-0310-87e3-a7336bc3aa68
Revision: 14650
Node Kind: directory
Schedule: normal
Last Changed Author: tredmond
Last Changed Rev: 14605
Last Changed Date: 2009-06-19 11:08:35 -0700 (Fri, 19 Jun 2009)

[tredmond@Andromeda protege-owl]$ ant clean
Buildfile: build.xml

clean:
   [delete] Deleting directory /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-owl/build

BUILD SUCCESSFUL
Total time: 4 seconds
[tredmond@Andromeda protege-owl]$ ant install
Buildfile: build.xml

checkProtegeHome:

useProtegeHome:
     [echo] Using Protege Home = /tmp/Protege3 to find protege jars

useLibDir:

checkProtegeLibs:

checkProtegeLibsAndReport:

init.time:

init:
    [mkdir] Created dir: /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-owl/build
    [mkdir] Created dir: /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-owl/build/classes
    [mkdir] Created dir: /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-owl/build/dist
    [mkdir] Created dir: /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-owl/build/plugins

compile:
    [javac] Compiling 1526 source files to /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-owl/build/classes
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
     [copy] Copying 334 files to /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-owl/build/classes
     [copy] Copied 63 empty directories to 56 empty directories under /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-owl/build/classes

jar:
     [copy] Copying 1 file to /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-owl/build
      [jar] Building jar: /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-owl/build/dist/protege-owl.jar

plugin.dir:
    [mkdir] Created dir: /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-owl/build/plugins/edu.stanford.smi.protegex.owl
     [copy] Copying 49 files to /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-owl/build/plugins/edu.stanford.smi.protegex.owl

plugin.zip:
      [zip] Building zip: /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-owl/build/dist/protege-owl.zip

install:
    [unzip] Expanding: /Andromeda/Users/tredmond/dev/workspaces/protege3/protege-owl/build/dist/protege-owl.zip into /tmp/Protege3/plugins
     [copy] Copying 2 files to /tmp/Protege3/examples/pizza
     [copy] Copying 2 files to /tmp/Protege3/examples/travel
     [copy] Copying 2 files to /tmp/Protege3/examples/family

BUILD SUCCESSFUL
Total time: 1 minute 1 second
[tredmond@Andromeda protege-owl]$ 

Now the Protege installation can load owl files.

Now the Protege owl build process depends on the protege.jar library that we built in the previous build step. Often developers deal with this by including a copy of the protege.jar file in the lib directory that is checked out by svn. But this approach creates problems because the protege.jar file in the lib directory gets out of date. Developers need to continually update this file leading to svn conflicts. Maven has an excellent approach to solving this problem in the form of repositories. We have chosen a different approach that does not have all the advantages of maven repositories but which is much simpler and works well enough for our needs. What happens in the above build file is that the Protege owl build process finds the protege.jar in the Protege installation directory. This means that the PROTEGE_HOME environment variable is used both to determine where to install owl and to determine where to find the needed dependencies. This makes it easy to build plugins with dependencies by building the dependencies first. It is also very easy to construct build scripts that build one protege plugin after another (e.g. the nci build script.

Now just to drill the point home, we will build one more plugin. This plugin is the standard extensions plugin which depends on both the protege.jar library and the protege-owl.jar library. Since the PROTEGE_HOME environment variable points to the latest protege.jar and protege-owl.jar, the standard-extensions plugin builds without any problems.


[tredmond@Andromeda standard-extensions]$ cd ../standard-extensions
[tredmond@Andromeda standard-extensions]$ svn info
Path: .
URL: http://smi-protege/repos/protege/standard-extensions/trunk
Repository Root: http://smi-protege/repos/protege
Repository UUID: 30a32298-b1ee-0310-87e3-a7336bc3aa68
Revision: 14650
Node Kind: directory
Schedule: normal
Last Changed Author: tredmond
Last Changed Rev: 14621
Last Changed Date: 2009-06-27 11:02:22 -0700 (Sat, 27 Jun 2009)

[tredmond@Andromeda standard-extensions]$ ant clean
Buildfile: build.xml

clean:
   [delete] Deleting directory /Andromeda/Users/tredmond/dev/workspaces/protege3/standard-extensions/build

BUILD SUCCESSFUL
Total time: 1 second
[tredmond@Andromeda standard-extensions]$ ant install
Buildfile: build.xml

init:
    [mkdir] Created dir: /Andromeda/Users/tredmond/dev/workspaces/protege3/standard-extensions/build
    [mkdir] Created dir: /Andromeda/Users/tredmond/dev/workspaces/protege3/standard-extensions/build/classes
    [mkdir] Created dir: /Andromeda/Users/tredmond/dev/workspaces/protege3/standard-extensions/build/plugins
    [mkdir] Created dir: /Andromeda/Users/tredmond/dev/workspaces/protege3/standard-extensions/build/plugins/edu.stanford.smi.protegex.standard_extensions

checkProtegeLibs:
     [echo] Using Protege Home = /tmp/Protege3 to find protege jars

checkProtegeLibsAndReport:

compile:
    [javac] Compiling 257 source files to /Andromeda/Users/tredmond/dev/workspaces/protege3/standard-extensions/build/classes
    [javac] Note: /Andromeda/Users/tredmond/dev/workspaces/protege3/standard-extensions/src/edu/stanford/smi/protegex/widget/uri/Icons.java uses or overrides a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
     [copy] Copying 19 files to /Andromeda/Users/tredmond/dev/workspaces/protege3/standard-extensions/build/classes
     [copy] Copied 4 empty directories to 1 empty directory under /Andromeda/Users/tredmond/dev/workspaces/protege3/standard-extensions/build/classes

images:
    [mkdir] Created dir: /Andromeda/Users/tredmond/dev/workspaces/protege3/standard-extensions/build/images
    [unjar] Expanding: /tmp/Protege3/protege.jar into /Andromeda/Users/tredmond/dev/workspaces/protege3/standard-extensions/build/images
     [copy] Copying 1 file to /Andromeda/Users/tredmond/dev/workspaces/protege3/standard-extensions/build/plugins/edu.stanford.smi.protegex.standard_extensions/html_export/images
     [copy] Copying 10 files to /Andromeda/Users/tredmond/dev/workspaces/protege3/standard-extensions/build/plugins/edu.stanford.smi.protegex.standard_extensions/html_export/images

jar:
     [copy] Copying 1 file to /Andromeda/Users/tredmond/dev/workspaces/protege3/standard-extensions/build
     [copy] Copying 5 files to /Andromeda/Users/tredmond/dev/workspaces/protege3/standard-extensions/build/plugins/edu.stanford.smi.protegex.standard_extensions/html_export
      [jar] Building jar: /Andromeda/Users/tredmond/dev/workspaces/protege3/standard-extensions/build/plugins/edu.stanford.smi.protegex.standard_extensions/standard-extensions.jar
     [copy] Copying 2 files to /Andromeda/Users/tredmond/dev/workspaces/protege3/standard-extensions/build/plugins/edu.stanford.smi.protegex.standard_extensions
     [copy] Copying 1 file to /Andromeda/Users/tredmond/dev/workspaces/protege3/standard-extensions/build/plugins/edu.stanford.smi.protegex.standard_extensions
     [copy] Copying 1 file to /Andromeda/Users/tredmond/dev/workspaces/protege3/standard-extensions/build/plugins/edu.stanford.smi.protegex.standard_extensions

dist:
      [zip] Building zip: /Andromeda/Users/tredmond/dev/workspaces/protege3/standard-extensions/build/standard-extensions.zip

install:
    [unzip] Expanding: /Andromeda/Users/tredmond/dev/workspaces/protege3/standard-extensions/build/standard-extensions.zip into /tmp/Protege3/plugins

BUILD SUCCESSFUL
Total time: 14 seconds
[tredmond@Andromeda standard-extensions]$ 

Troubleshooting

Missing protege libraries

First make sure that your PROTEGE_HOME environment variable is pointing to a real Protege distribution. This message is telling you that there is some library that this plugin depends on that is not being found as a plugin in the Protege installation. I will give a Protege 4 example in this case to illustrate the problem and how you can fix it.

I will use then Protege 4 difference plugin as an example because it is a good example of a project with a dependency. It can be checked out from svn here. If you check this out and run it you may see the following message:

checkProtegeLibsAndReport:
     [echo] Missing protege libraries.  You need to set 
     [echo] the PROTEGE_HOME environment variable to a
     [echo] protege installation directory where the
     [echo] appropriate plugins have been installed.
     [echo] Alternatively set the jar libs in local.properties (protege.lib=...)
     [echo] Use the -v option to ant to see what jars are missing.

BUILD FAILED
/home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/build.xml:80: missing protege libraries

It would be nice if this message was more helpful but I haven't figured out how to do that yet. To find out what library is missing run the ant script with the -v parameter:

[tredmond@Saturn org.protege.editor.owl.diff]$ ant -v install
Apache Ant version 1.8.1 compiled on October 13 2010
Trying the default build file: build.xml
Buildfile: /home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/build.xml
Detected Java version: 1.5 in: /usr/local/java/jdk1.5.0_21/jre
Detected OS: Linux
parsing buildfile /home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/build.xml with URI = file:/home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/build.xml
Project base dir set to: /home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff
parsing buildfile jar:file:/usr/share/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/usr/share/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
 [property] Loading Environment env.
 [property] Loading /home/tredmond/dev/workspaces/protege4.1/Protege/build.properties
 [property] Loading /home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/local.properties
 [property] Unable to find property file: /home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/local.properties
 [property] Loading /home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/version.properties
 [property] Unable to find property file: /home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/version.properties
Build sequence for target(s) `install' is [init, checkProtegeLibs, checkProtegeLibsAndReport, buildlibs, compile, build.manifest, copy.resources, create.update.properties, jar, install]
Complete build sequence is [init, checkProtegeLibs, checkProtegeLibsAndReport, buildlibs, compile, build.manifest, copy.resources, create.update.properties, jar, install, debug, run, jaxb, clean, usage, ]

init:
    [mkdir] Skipping /home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/build because it already exists.
    [mkdir] Skipping /home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/build/classes because it already exists.
    [mkdir] Skipping /home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/build/classes/lib because it already exists.
    [mkdir] Skipping /home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/build/lib because it already exists.

checkProtegeLibs:
     [echo] **********************************************************
     [echo] Using Protege Home = /home/tredmond/dev/workspaces/protege4.1/Protege
     [echo] Using Java Version = 1.5
     [echo] **********************************************************
[available] Found file: /home/tredmond/dev/workspaces/protege4.1/Protege/bin/felix.jar
[available] Found file: /home/tredmond/dev/workspaces/protege4.1/Protege/bundles/org.eclipse.equinox.common.jar
[available] Found file: /home/tredmond/dev/workspaces/protege4.1/Protege/bundles/org.eclipse.equinox.registry.jar
[available] Found file: /home/tredmond/dev/workspaces/protege4.1/Protege/plugins/org.protege.editor.owl.jar
[available] Found file: /home/tredmond/dev/workspaces/protege4.1/Protege/plugins/org.semanticweb.owl.owlapi.jar
[available] Unable to find file /home/tredmond/dev/workspaces/protege4.1/Protege/plugins/org.protege.owl.diff.jar

checkProtegeLibsAndReport:
     [echo] Missing protege libraries.  You need to set 
     [echo] the PROTEGE_HOME environment variable to a
     [echo] protege installation directory where the
     [echo] appropriate plugins have been installed.
     [echo] Alternatively set the jar libs in local.properties (protege.lib=...)
     [echo] Use the -v option to ant to see what jars are missing.

BUILD FAILED
/home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/build.xml:80: missing protege libraries
	at org.apache.tools.ant.taskdefs.Exit.execute(Exit.java:164)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:592)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:390)
	at org.apache.tools.ant.Target.performTasks(Target.java:411)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1249)
	at org.apache.tools.ant.Main.runBuild(Main.java:801)
	at org.apache.tools.ant.Main.startAnt(Main.java:218)
	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

Total time: 0 seconds
[tredmond@Saturn org.protege.editor.owl.diff]$ 

The -v option generates a lot of output most of which you will ignore. But scroll up from the bottom and you will see the lines:

checkProtegeLibs:
     [echo] **********************************************************
     [echo] Using Protege Home = /home/tredmond/dev/workspaces/protege4.1/Protege
     [echo] Using Java Version = 1.5
     [echo] **********************************************************
[available] Found file: /home/tredmond/dev/workspaces/protege4.1/Protege/bin/felix.jar
[available] Found file: /home/tredmond/dev/workspaces/protege4.1/Protege/bundles/org.eclipse.equinox.common.jar
[available] Found file: /home/tredmond/dev/workspaces/protege4.1/Protege/bundles/org.eclipse.equinox.registry.jar
[available] Found file: /home/tredmond/dev/workspaces/protege4.1/Protege/plugins/org.protege.editor.owl.jar
[available] Found file: /home/tredmond/dev/workspaces/protege4.1/Protege/plugins/org.semanticweb.owl.owlapi.jar
[available] Unable to find file /home/tredmond/dev/workspaces/protege4.1/Protege/plugins/org.protege.owl.diff.jar

These lines tell you how you have set the PROTEGE_HOME environment variable and which required Protege libraries have been found in that location. In this case the ant script found the following libraries:

  • felix.jar: this library represents the OSGi environment.
  • org.eclipse.equinox.common.jar: I don't really know what this does but the eclipse registry plugin needs this.
  • org.eclipse.equinox.registry.jar: this library implements the eclipse plugin mechanism that is used by Protege 4
  • org.protege.editor.owl.jar: This is the OWL editor plugin for Protege 4.1.
  • org.semanticweb.owl.owlapi.jar: this is the Manchester OWL api packaged as a Protege bundle

Right after it informs you that it finds these libraries, it tells you that it could not find the org.protege.owl.diff.jar library. To make this build script work you will need to checkout the sources for this library from here and build and install that library. Here I show how I build that library and then I am able to build and install the difference editor plugin:

[tredmond@Saturn org.protege.owl.diff]$ ant clean install
Buildfile: /home/tredmond/dev/workspaces/protege4.1/org.protege.owl.diff/build.xml

clean:
   [delete] Deleting directory /home/tredmond/dev/workspaces/protege4.1/org.protege.owl.diff/build

init:
    [mkdir] Created dir: /home/tredmond/dev/workspaces/protege4.1/org.protege.owl.diff/build
    [mkdir] Created dir: /home/tredmond/dev/workspaces/protege4.1/org.protege.owl.diff/build/classes
    [mkdir] Created dir: /home/tredmond/dev/workspaces/protege4.1/org.protege.owl.diff/build/classes/lib
    [mkdir] Created dir: /home/tredmond/dev/workspaces/protege4.1/org.protege.owl.diff/build/lib

checkProtegeLibs:
     [echo] **********************************************************
     [echo] Using Protege Home = /home/tredmond/dev/workspaces/protege4.1/Protege
     [echo] Using Java Version = 1.5
     [echo] **********************************************************

checkProtegeLibsAndReport:

buildlibs:
    [unjar] Expanding: /home/tredmond/dev/workspaces/protege4.1/Protege/bundles/org.protege.common.jar into /home/tredmond/dev/workspaces/protege4.1/org.protege.owl.diff/build

compile:
    [javac] Compiling 46 source files to /home/tredmond/dev/workspaces/protege4.1/org.protege.owl.diff/build/classes

build.manifest:
     [copy] Copying 1 file to /home/tredmond/dev/workspaces/protege4.1/org.protege.owl.diff/build

copy.resources:
     [copy] Copying 1 file to /home/tredmond/dev/workspaces/protege4.1/org.protege.owl.diff/build/classes
     [copy] Copying 2 files to /home/tredmond/dev/workspaces/protege4.1/org.protege.owl.diff/build/classes
    [mkdir] Created dir: /home/tredmond/dev/workspaces/protege4.1/org.protege.owl.diff/build/classes/META-INF
     [copy] Copying 1 file to /home/tredmond/dev/workspaces/protege4.1/org.protege.owl.diff/build/classes/META-INF

create.update.properties:

jar:
      [jar] Building jar: /home/tredmond/dev/workspaces/protege4.1/org.protege.owl.diff/build/org.protege.owl.diff.jar

install:
     [copy] Copying 1 file to /home/tredmond/dev/workspaces/protege4.1/Protege/plugins

BUILD SUCCESSFUL
Total time: 2 seconds
[tredmond@Saturn org.protege.owl.diff]$ cd ../org.protege.editor.owl.diff
[tredmond@Saturn org.protege.editor.owl.diff]$ ant clean install
Buildfile: /home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/build.xml

clean:
   [delete] Deleting directory /home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/build

init:
    [mkdir] Created dir: /home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/build
    [mkdir] Created dir: /home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/build/classes
    [mkdir] Created dir: /home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/build/classes/lib
    [mkdir] Created dir: /home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/build/lib

checkProtegeLibs:
     [echo] **********************************************************
     [echo] Using Protege Home = /home/tredmond/dev/workspaces/protege4.1/Protege
     [echo] Using Java Version = 1.5
     [echo] **********************************************************

checkProtegeLibsAndReport:

buildlibs:
    [unjar] Expanding: /home/tredmond/dev/workspaces/protege4.1/Protege/bundles/org.protege.common.jar into /home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/build

compile:
    [javac] Compiling 10 source files to /home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/build/classes

build.manifest:
     [copy] Copying 1 file to /home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/build

copy.resources:
     [copy] Copying 3 files to /home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/build/classes
    [mkdir] Created dir: /home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/build/classes/META-INF
     [copy] Copying 1 file to /home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/build/classes/META-INF

create.update.properties:

jar:
      [jar] Building jar: /home/tredmond/dev/workspaces/protege4.1/org.protege.editor.owl.diff/build/org.protege.editor.owl.diff.jar

install:
     [copy] Copying 1 file to /home/tredmond/dev/workspaces/protege4.1/Protege/plugins

BUILD SUCCESSFUL
Total time: 1 second
[tredmond@Saturn org.protege.editor.owl.diff]$