Difference between revisions of "CompileProtege4InEclipse"

From Protege Wiki
Jump to: navigation, search
m
Line 1: Line 1:
<span style="font-size:22px; font-weight:bold; color:#DC7317;">Compile and run the Protege-OWL editor (4.0 alpha) from Eclipse</span>
+
<span style="font-size:22px; font-weight:bold; color:#DC7317;">Compile and run the Protege 4 OWL editor from Eclipse</span>
 
<br /><br />
 
<br /><br />
  
To follow are instructions for compiling and running the 4.0 alpha version of the [http://protege.stanford.edu/overview/protege-owl.html Protege-OWL editor] from the [http://www.eclipse.org/ Eclipse development environment]This documentation takes the approach of creating a '''separate Eclipse project for each OSGi bundle''' in the Protege 4 source tree.
+
This document is in progress. While it is not fully documented yet it
 +
does represent the recommended way to set up a protege 4 environment
 +
in eclipse.  If this documentation is insufficient the fall back is to
 +
go to the  
 +
[[Protege4DevDocs#Protege-OWL_editor_in_a_Generic_IDE|generic ide instructions]].
  
Please note that:
+
# Download the protege plug-ins with linked source. Currently these can be found [[http://protege.stanford.edu/fileshare/tredmond/Protege4Bundles/|here]] but soon there will be a standard download page connected to each of our releases.
 +
# Create a new eclipse workspace
 +
# Click "File -> Import..."  This will bring up a dialog box.
 +
# Choose "Plug-in Development -> Plug-ins and Fragments" and click "Next".  This will bring up a dialog box.
 +
# Unselect "The target platform (as specified in the Preferences)"
 +
# Click the browse button and browse to the directory where you downloaded the protege plug-ins with linked source
 +
# Don't worry about the warning at the top of the dialog box.  The "Plug-ins and Fragments to Import" box should say "Select from all plug-ins..." and the "Import As" box should say "Binary projects".
 +
# Click next bringing up a new dialog box.
 +
# Click "Add All".  You should see the following plugins
 +
** org.protege.common.jar (mandatory)
 +
** org.protege.editor.core.appllication.jar (mandatory)
 +
** org.protege.editor.owl.jar (mandatory)
 +
** org.semanticweb.owl.owlapi.jar (mandatory)
 +
** com.owldl.pellet (optional)
 +
** org.coode.dlquery (optional)
 +
** uk.ac.manchester.cs.owl.factplusplus (optional)
 +
# Click "Finish"
  
* These instructions are only valid for the 4.0 alpha version of Protege. If you want to compile and run the 3.x versions of Protege, we have separate instructions [http://protege.cim3.net/cgi-bin/wiki.pl?CompileProtegeSourcesInIDE#nid9EM available elsewhere].
+
This is a milestone. You should now see the Protege bundles as
* This is only one of several possible ways of compiling and running Protege 4 from Eclipse.  This particular page is not meant to be exhaustive.<br /><br />
+
imported Plug-in projects.
  
__TOC__
+
== Creating a Runnable for Windows or Linux ==
  
== Create the <code>org.protege.common</code> project ==
+
We now need to create a runnable. As far
Go to the SVN Repository Exploring perspective and navigate to <code>protege4/protege-standalone/trunk/plugins/org.protege.common</code>This step assumes that you have Subversion support installed for the Eclipse IDE and that you have already connected to the Protege Subversion repository. If you have not done this, we have [[ProtegeDevDocsGeneral#Connect_to_the_Protege_Subversion_respository_from_Eclipse|instructions for doing so]] on our Wiki.
+
as I can tell Mac users cannot get the following steps to workIt is
 +
that this does work on intel macs but I have not been able to test this.
 +
There are claims made on the web saying that this issue is solved.
 +
... Here ... is my current status on this issue.  Mac users need to
 +
use an alternative ... method ...
  
Right-click on the <code>org.protege.common</code> folder and choose Checkout... In the resulting "Checkout from SVN" dialog, leave all of the default settings (as shown below) and click Finish.<br /><br />
+
Windows and Linux users now do the following to make a runnable.
 +
# Click "Run -> Debug Configurations". This will bring up a dialog
 +
box.
 +
# Select "OSGi Framework" and click the "New" Icon at the top.
 +
# Name the "New_Configuration" something useful like "Protege".
 +
# In the Bundles box, scroll down to where it says "Target Platform".  Unselect all the bundles from the target platform (one click to the left of "Target Platform")
 +
# Click on "Add Required Bundles".
 +
# Click "Apply" to save your changes.
 +
# Click "Debug" and Protege should come up.  
  
[[Image:Checkout-dialog.jpg]]<br /><br />
+
Windows and Linux users should now be able to easily use eclipse to develop their plug-ins.  To start a new bundle just create a new Eclipse Plug-in project.  These projects will automatically get attached to the Protege runnable.
  
In the "New Project" dialog, choose Plug-in Project and click Next >.<br /><br />
+
== Creating a Runnable for OS X ==
  
[[Image:New-project-dialog.jpg]]<br /><br />
+
OS X users have to work a bit harder to get a working runnable.  They
 +
need to checkout the ide project as a general project from svn at
 +
[[http://smi-protege.stanford.edu/repos/protege/protege4/small-projects/ide/trunk]].
 +
Then they must
 +
#
 +
# Set the working directory to ${workspace_loc:ide}.
 +
# Set the classpath to be ide/org.eclipse.osgi.jar
 +
# Set the -D plugin.in vars
  
In the "New Plug-in Project" dialog, type <code>org.protege.common</code> in the Project name text box.  Leave the default settings in the Project Settings and Target Platform sections.  For this documentation, we will also use the default location for the project.  Click the Next > button.<br /><br />
+
At this point, mac users can create Eclipse Plug-in projects to create
 
+
their own plug-ins. But the
[[Image:New-plugin-project-dialog.jpg]]<br /><br />
 
 
 
For the Plug-in Content section, uncheck both of the checkboxes in the Plug-in Options section and leave all other default settings.<br /><br />
 
 
 
[[Image:Plugin-content-dialog2.jpg]]<br /><br />
 
 
 
If you are curious about what any of these settings mean, you can click the question mark (help) icon in the lower-left corner of the New Project Plug-in dialog and browse the Eclipse documentation.
 
 
 
Click the Finish button.  At this point, Eclipse will ask you if you want to use the Plug-in Development perspective for your project:<br /><br />
 
 
 
[[Image:Associated-perspective-dialog.jpg]]<br /><br />
 
 
 
Check the "Remember my decision" checkbox and click the Yes button.  Then, click OK on the "Confirm Overwrite" dialog.  Eclipse will now begin checking out the source code for the <code>org.protege.common</code> bundle.  Your Package Explorer will look something like the following after the checkout is complete:<br /><br />
 
 
 
[[Image:Protege-common-explorer.jpg]]<br /><br />
 
 
 
If you have Project | Build Automatically turned on, you will notice compiler errors after checking out the source code.  To fix them, right-click on the <code>org.protege.common</code> project and bring up the Properties dialog.  Go to the Libraries tab in the Java Build Path section.  Click the Add Jars... button and add all the JAR files that are in the <code>org.protege.common/lib</code> directory:<br /><br />
 
 
 
[[Image:Protege-common-build-path.jpg]]<br /><br />
 
 
 
The project will now build successfully.  The steps for creating projects for the remaining three bundles are largely the same.<br /><br />
 
 
 
== Create the <code>org.protege.editor.core.application</code> project ==
 
To create a project for the <code>org.protege.editor.core.application</code> bundle:
 
 
 
* Right-click on the <code>protege4/protege-standalone/trunk/plugins/org.protege.editor.core.application</code> folder in the SVN Repository Exploring perspective and choose Checkout...
 
* Click Finish on the Checkout from SVN dialog without changing any of the default settings.
 
* Choose Plug-in Project in the New Project dialog and click Next >.
 
* Enter <code>org.protege.editor.core.application</code> in the Project name text box and click Next >.
 
* Uncheck both checkboxes in the the Plug-in Options section and click Finish.
 
* Click OK on the Confirm Overwrite dialog.
 
* After the checkout completes, right-click on the <code>org.protege.editor.core.application</code> project in the Package Explorer and bring up the Properties dialog.
 
* On the Libraries tab in the Java Build Path section, click the Add Jars... button.
 
* Add all of the JAR files from the <code>org.protege.editor.core.application/lib</code> and <code>org.protege.common/lib</code> directories:<br /><br />
 
 
 
[[Image:Core-application-build-path.jpg]]<br /><br />
 
 
 
* Click OK and the project will now build successfully.<br /><br />
 
 
 
== Create the <code>org.semanticweb.owl.owlapi</code> project ==
 
To create a project for the <code>org.semanticweb.owl.owlapi</code> bundle:
 
 
 
* Right-click on the <code>protege4/protege-standalone/trunk/plugins/org.semanticweb.owl.owlapi</code> folder in the SVN Repository Exploring perspective and choose Checkout...
 
* Click Finish on the Checkout from SVN dialog without changing any of the default settings.
 
* Choose Plug-in Project in the New Project dialog and click Next >.
 
* Enter <code>org.semanticweb.owl.owlapi</code> in the Project name text box and click Next >.
 
* Uncheck both checkboxes in the the Plug-in Options section and click Finish.
 
* Click OK on the Confirm Overwrite dialog.
 
* After the checkout completes, right-click on the <code>org.semanticweb.owl.owlapi</code> project in the Package Explorer and bring up the Properties dialog.
 
* On the Libraries tab in the Java Build Path section, click the Add Jars... button.
 
* Add all of the JAR files from the <code>org.semanticweb.owl.owlapi/lib</code> directory:<br /><br />
 
 
 
[[Image:Owlapi-build-path.jpg]]<br /><br />
 
 
 
* Click OK and the project will now build successfully.<br /><br />
 
 
 
== Create the <code>org.protege.editor.owl</code> project ==
 
To create a project for the <code>org.protege.editor.owl</code> bundle:
 
 
 
* Right-click on the <code>protege4/protege-standalone/trunk/plugins/org.protege.editor.owl</code> folder in the SVN Repository Exploring perspective and choose Checkout...
 
* Click Finish on the Checkout from SVN dialog without changing any of the default settings.
 
* Choose Plug-in Project in the New Project dialog and click Next >.
 
* Enter <code>org.protege.editor.owl</code> in the Project name text box and click Next >.
 
* Uncheck both checkboxes in the the Plug-in Options section and click Finish.
 
* Click OK on the Confirm Overwrite dialog.
 
* After the checkout completes, right-click on the <code>org.protege.editor.owl</code> project in the Package Explorer and bring up the Properties dialog.
 
* On the Libraries tab in the Java Build Path section, click the Add Jars... button.
 
* Add all of the JAR files from the following directories:
 
** <code>org.protege.editor.owl/lib</code>
 
** <code>org.semanticweb.owl.owlapi/lib</code>
 
** <code>org.protege.editor.core.application/lib</code>
 
** <code>org.protege.common/lib</code><br /><br />
 
 
 
[[Image:Owleditor-build-path.jpg]]<br /><br />
 
 
 
* Click OK and the project will now build successfully.  You have now created and configured projects for the minimum number of OSGi bundles necessary to run the Protege-OWL editor.<br /><br />
 
 
 
== Create a Run configuration ==
 

Revision as of 11:52, February 4, 2009

Compile and run the Protege 4 OWL editor from Eclipse

This document is in progress. While it is not fully documented yet it does represent the recommended way to set up a protege 4 environment in eclipse. If this documentation is insufficient the fall back is to go to the generic ide instructions.

  1. Download the protege plug-ins with linked source. Currently these can be found [[1]] but soon there will be a standard download page connected to each of our releases.
  2. Create a new eclipse workspace
  3. Click "File -> Import..." This will bring up a dialog box.
  4. Choose "Plug-in Development -> Plug-ins and Fragments" and click "Next". This will bring up a dialog box.
  5. Unselect "The target platform (as specified in the Preferences)"
  6. Click the browse button and browse to the directory where you downloaded the protege plug-ins with linked source
  7. Don't worry about the warning at the top of the dialog box. The "Plug-ins and Fragments to Import" box should say "Select from all plug-ins..." and the "Import As" box should say "Binary projects".
  8. Click next bringing up a new dialog box.
  9. Click "Add All". You should see the following plugins
    • org.protege.common.jar (mandatory)
    • org.protege.editor.core.appllication.jar (mandatory)
    • org.protege.editor.owl.jar (mandatory)
    • org.semanticweb.owl.owlapi.jar (mandatory)
    • com.owldl.pellet (optional)
    • org.coode.dlquery (optional)
    • uk.ac.manchester.cs.owl.factplusplus (optional)
  1. Click "Finish"

This is a milestone. You should now see the Protege bundles as imported Plug-in projects.

Creating a Runnable for Windows or Linux

We now need to create a runnable. As far as I can tell Mac users cannot get the following steps to work. It is that this does work on intel macs but I have not been able to test this. There are claims made on the web saying that this issue is solved. ... Here ... is my current status on this issue. Mac users need to use an alternative ... method ...

Windows and Linux users now do the following to make a runnable.

  1. Click "Run -> Debug Configurations". This will bring up a dialog

box.

  1. Select "OSGi Framework" and click the "New" Icon at the top.
  2. Name the "New_Configuration" something useful like "Protege".
  3. In the Bundles box, scroll down to where it says "Target Platform". Unselect all the bundles from the target platform (one click to the left of "Target Platform")
  4. Click on "Add Required Bundles".
  5. Click "Apply" to save your changes.
  6. Click "Debug" and Protege should come up.

Windows and Linux users should now be able to easily use eclipse to develop their plug-ins. To start a new bundle just create a new Eclipse Plug-in project. These projects will automatically get attached to the Protege runnable.

Creating a Runnable for OS X

OS X users have to work a bit harder to get a working runnable. They need to checkout the ide project as a general project from svn at [[2]]. Then they must

  1. Set the working directory to ${workspace_loc:ide}.
  2. Set the classpath to be ide/org.eclipse.osgi.jar
  3. Set the -D plugin.in vars

At this point, mac users can create Eclipse Plug-in projects to create their own plug-ins. But the