ObdalibPluginDebug
This page describe how to debug Protege Plugin of Ontop from Eclipse or IntelliJ.
If you just want to test the plugin (without debugging), you only need to follow the first two steps to build the protege plugin and run protege as usual.
1. Download the protege bundle
Download Protege bundle from the ontop website (http://ontop.inf.unibz.it/?page_id=11) and unzip it to e.g. `~/Downloads/Protege_5`
2. cd to the directory of ontop and compile the ontop project
$ cd ontop
$ mvn install -DskipTests
$ vim .bash_profile
Add this line: export JAVA_HOME=$(/usr/libexec/java_home)
$ source .bash_profile
$ cd obdalib-protege41
$ mvn bundle:bundle -DskipTests
$ cp target/it.unibz.inf.obda.p4plugin-1.11.0.jar ~/Downloads/Protege_5/plugins/
Be sure that there is only one Protege plugin in the plugins
directory of Protege
Note that every time you modify the code, you need to recompile the ontop project and re-generate the plugin
The version of Eclipse used in this document is Kepler. Create new run configuration in Eclipse, call it "run protege" or similar.
Set the following arguments:
Project: ontop-protege4
Main Class: org.protege.osgi.framework.Launcher
Set the VM args to
-Dosgi.clean=true
-Dlog4j.configuration=file:log4j.xml
-Dorg.protege.allow.directory.bundles=true
-Dorg.protege.plugin.extra="${workspace_loc:ontop-protege4}\target\classes"
-Xmx3072m
Add two jars from Protege to the classpath
Now you can debug/run the protege plugin. If you see the following warning, simply ignore it.
You can set the breakpoint in Eclipse like in the following screen shot.
- Main Class:
org.protege.osgi.framework.Launcher
- VM Options
-Dosgi.clean=true
-Dlog4j.configuration=file:log4j.xml
-Dorg.protege.allow.directory.bundles=true
-Dorg.protege.plugin.extra="${workspace_loc:ontop-protege4}\target\classes"
-Xmx3072m
- Working Directory: directory of Protege
- Use classpath of module:
ontop-protege4
- Problem: Protege doesn't load ontop
* Possible solution: Check that you there are no other ontop packages in the target directory when you build the package