CompileProtege5InEclipseWithMaven

From Protege Wiki
Revision as of 14:00, August 2, 2013 by Tredmond (talk | contribs) (Configuring Eclipse)

Jump to: navigation, search

Instructions for setting up Eclipse for working with Protege using maven

Under construction

Prerequisites

To follow these directions you will need the following tools:

  • Eclipse (of course) with
    • the Plugin Development tools included. As indicated here, the plugin development environment comes with the Java EE or the RCP/Plugin versions of eclipse.
    • the Eclipse Subversive plugin, though this is only required if you want to do svn updates using eclipse. Note that there is another similar but different plugin (from Tigris I believe). I don't know if these plugins interfere with one another if they are both loaded.
  • A tool for checking out a repository from subversion (e.g. tortoise or the svn command line client).
  • The maven build tool.

These directions are based on a preconfigured workspace which you can use for the build.

Configuring Eclipse

This is just one method of setting up eclipse and so feel free to adjust the approach to suit your preferences. When I first set up eclipse this way, I decided to have the Protege source tree be in a separate but parallel directory to the eclipse workspace. I decided that I like this arrangement because, as you will see, it ensures that the eclipse workspace files don't show up as modifications to the Protege source tree sources.

The first step in this process is to check-out the Protege sources. This can be done by checking out the svn tree (https://smi-protege.stanford.edu/repos/protege/protege4/misc/composite/protege5/trunk protege5). You can use any client that you like to perform the ckeck-out but for my command line client the command is as follows:

            svn checkout https://smi-protege.stanford.edu/repos/protege/protege4/misc/composite/protege5/trunk protege5

Now we build Protege using the maven command:

    cd protege5
    mvn clean install

This takes a little while to run (between two and three minutes on my computer) so now would be a good time to go get a cup of coffee. By running this, we have built a fully functional copy of Protege (in a directory with a name like protege-distribution/target/protege-distribution-5.0.0-beta-04-bin/Protege) and we have arranged that any generated source directories needed by the build are present. Now we use maven to add the eclipse project information to the Protege plugin sources:

    mvn eclipse:eclipse

Now we are ready to start eclipse. I start eclipse and I make the new workspace be a directory parallel to the protege5 directory that I have been working on and I call it protege5-eclipse. Once eclipse has started, change to the Plug-in Development perspective. From the file menu click Import, select General/Existing Projects into Workspace, and click next:

MavenEclipseImportExisting1.png

Running Protege

Add your own plugin