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)
Line 6: Line 6:
 
       git clone https://github.com/stdotjohn/org.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  
+
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:
 
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:
Line 22: Line 22:
 
<description>A dummy plugin to jump-start developers</description>  
 
<description>A dummy plugin to jump-start developers</description>  
 
</pre>
 
</pre>
The new version may
+
The new version may look something more like this:
 
 
 
<pre>
 
<pre>
<groupId>edu.stanford.protege</groupId>
+
<groupId>edu.ontology.plugin</groupId>
<artifactId>org.protege.plugin.template</artifactId>
+
<artifactId>my.plugin</artifactId>
 
<version>0.1.0-SNAPSHOT</version>
 
<version>0.1.0-SNAPSHOT</version>
<name>Dummy plugin</name>  
+
<name>Some plugin name</name>  
<description>A dummy plugin to jump-start developers</description>  
+
<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>
 
</pre>

Revision as of 11:50, September 1, 2013

Quick-start a Protege 5 plugin with maven and git

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