Difference between revisions of "Quick start for Protege Plugin with maven"

From Protege Wiki
Jump to: navigation, search
(Quick-start a Protege 5 plugin with maven and git)
(Quick-start a Protege 5 plugin with maven and git)
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
  
 
=Quick-start a Protege 5 plugin with maven and git=
 
=Quick-start a Protege 5 plugin with maven and git=
 +
 +
'''''Experimental instructions for Protege 5'''''
  
 
You can very quickly start a new plugin using maven and git.  The strategy is to use git to clone a project that has a very [https://github.com/stdotjohn/org.protege.plugin.template minimal plugin template] and then to start modifying this project to make it your own.  The first step is to clone the template into a project directory of your choice:
 
You can very quickly start a new plugin using maven and git.  The strategy is to use git to clone a project that has a very [https://github.com/stdotjohn/org.protege.plugin.template minimal plugin template] and then to start modifying this project to make it your own.  The first step is to clone the template into a project directory of your choice:
 
<pre>
 
<pre>
       git clone https://github.com/stdotjohn/ort.protege.plugin.template my.plugin
+
       git clone https://github.com/stdotjohn/org.protege.plugin.template my.plugin
 
</pre>
 
</pre>
 +
Note that if you are prompted for a password, it might mean that you mispelled the git repository that you are cloning.  At this point you can immediately start building the plugin and start testing it.  But there are two other things that we should do first in order to make this plugin your own. This project comes with a ReadMe.txt file that includes a version of the instructions here for modifying the plugin for your use.
 +
 +
First we need to make some small changes to the pom.xml file. Look for ''Change me!'' in the pom.xml file.  At this time there is only one small section that needs updating that needs updating.  In its original form it looks like this:
 +
<pre>
 +
<!-- Change me!
 +
 +
        The next five properties should probably be customized for
 +
        your project.  If you don't know what to use for groupId,
 +
        don't worry, you can deal with that when you are ready for maven.
 +
      -->
 +
<groupId>edu.stanford.protege</groupId>
 +
<artifactId>org.protege.plugin.template</artifactId>
 +
<version>0.1.0-SNAPSHOT</version>
 +
<name>Dummy plugin</name>
 +
<description>A dummy plugin to jump-start developers</description>
 +
</pre>
 +
The new version may look something more like this:
 +
<pre>
 +
<groupId>edu.ontology.plugin</groupId>
 +
<artifactId>my.plugin</artifactId>
 +
<version>0.1.0-SNAPSHOT</version>
 +
<name>Some plugin name</name>
 +
<description>A plugin to perform some amazing ontology task</description>
 +
</pre>
 +
You will also want to remove the upstream project, e.g. you no longer need to pull or push changes from the Protege plugin template project.  This is done with the following two commands:
 +
<pre>
 +
          git branch -d -r origin/master
 +
          git remote remove origin
 +
</pre>
 +
When you are ready to push to a main git repository, you can set the origin to another value and perform a push to that location:
 +
<pre>
 +
        git remote add origin http://github.com/me/mynewplugin.git
 +
        git push --set-upstream origin master
 +
</pre>
 +
 +
The project is now ready to build which can be done with following steps:
 +
<pre>
 +
      mvn clean install
 +
</pre>
 +
 +
After this there are some more minor less urgent cleanup tasks to do.  You will probably want to remove or replace the readme file for the project.  In addition, there is a package called template which contains some dummy protege extensions which whold be deleted. Finally you will want to clean up the plugin.xml file so that it only contains the plugins that you want to see.

Latest revision as of 12:19, September 1, 2013

Quick-start a Protege 5 plugin with maven and git

Experimental instructions for Protege 5

You can very quickly start a new plugin using maven and git. The strategy is to use git to clone a project that has a very minimal plugin template and then to start modifying this project to make it your own. The first step is to clone the template into a project directory of your choice:

      git clone https://github.com/stdotjohn/org.protege.plugin.template my.plugin

Note that if you are prompted for a password, it might mean that you mispelled the git repository that you are cloning. At this point you can immediately start building the plugin and start testing it. But there are two other things that we should do first in order to make this plugin your own. This project comes with a ReadMe.txt file that includes a version of the instructions here for modifying the plugin for your use.

First we need to make some small changes to the pom.xml file. Look for Change me! in the pom.xml file. At this time there is only one small section that needs updating that needs updating. In its original form it looks like this:

	<!-- Change me! 

         The next five properties should probably be customized for
         your project.  If you don't know what to use for groupId,
         don't worry, you can deal with that when you are ready for maven.
      -->
	<groupId>edu.stanford.protege</groupId>
	<artifactId>org.protege.plugin.template</artifactId>
	<version>0.1.0-SNAPSHOT</version>
	<name>Dummy plugin</name> 
	<description>A dummy plugin to jump-start developers</description> 

The new version may look something more like this:

	<groupId>edu.ontology.plugin</groupId>
	<artifactId>my.plugin</artifactId>
	<version>0.1.0-SNAPSHOT</version>
	<name>Some plugin name</name> 
	<description>A plugin to perform some amazing ontology task</description> 

You will also want to remove the upstream project, e.g. you no longer need to pull or push changes from the Protege plugin template project. This is done with the following two commands:

          git branch -d -r origin/master
          git remote remove origin

When you are ready to push to a main git repository, you can set the origin to another value and perform a push to that location:

         git remote add origin http://github.com/me/mynewplugin.git
         git push --set-upstream origin master

The project is now ready to build which can be done with following steps:

      mvn clean install

After this there are some more minor less urgent cleanup tasks to do. You will probably want to remove or replace the readme file for the project. In addition, there is a package called template which contains some dummy protege extensions which whold be deleted. Finally you will want to clean up the plugin.xml file so that it only contains the plugins that you want to see.