3. Creating Plugins.

Table of Contents

3.1. Writing the Plugin.
3.2. Publishing the Plugin.
3.2.1. Deploying the Plugin artifact.
3.2.2. Describing the Plugin.
3.2.3. Installing the Plugin.
3.3. Publishing Plugin updates.

3.1. Writing the Plugin.

We assume at this point you are know what your plugin is going to do, and are familiar with the Taverna API, and inparticular which SPI(s) you are going to use as your extension point(s).

Before you embark on writing your plugin it is necessary that you familiarise yourself with Maven 2, version 2.0.4, as this will be necessary for publishing your Plugin as artifacts. We also recommend using the Maven 2 Plugin within Eclipse. Its beyond the scope of this guide to go into great detail about using Maven, but there is a good free book available, Better Builds with Maven, and plenty of other resources available on the Web. As a starting point, although not essential, it is advisable to structure your project as follows:

  • src/main/java/ - your main java sourcecode

  • src/main/resources/ - your resources, including declared SPI's in META-INF/services/

  • src/test/java/ - your java unit tests

  • pom.xml - the project configuration file

If you use the Maven plugin for Eclipse, it will generate your pom.xml for you when you enable Maven for your java project. It will contain information that looks like the following. This file will grow over time as your project evolves.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.myproject.app</groupId>
  <artifactId>my-app</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>My Funky Plugin</name>

  <repositories>
    <repository>
      <id>mygrid-repository</id>
      <name>myGrid Repository</name>
      <url>http://www.mygrid.org.uk/maven/repository</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <releases>
        <enabled>true</enabled>
      </releases>
    </repository>
  <repositories>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

</project>

You need to include the mygrid-repository to be able to add Taverna dependencies to your project.

Important

Its important that when you define your Taverna dependencies you use artifact versions that are consistent with the version of Taverna you are wish to install your plugin into. If the version of Taverna is 1.7.1.x then you will want your artifact versions to be 1.7.1.x, though x itself doesn't need to match. In general when moving between 3rd order versions most plugins will simply need their dependencies changing and the plugin rebuilding with minimal, if any, code changes. You should read the Taverna versioning section for more detailed information.