Part 4.1: Building and packaging your plugin
This tutorial covers how to use Maven to build and package your plugin for use with Funnelback.
Prerequisites
Before using this guide ensure that you have written and tested your plugin as covered in Part 3. Writing your plugin of the developing your first plugin guide.
Building the plugin
-
Open up a terminal window and change to the folder at the root of the
title-prefix-plugin
project (the folder containingpom.xml
) -
Run the following Maven command:
$ mvn clean package
This builds, runs the tests and assembles the plugin into a subfolder:
target/<version>
where version is what was defined when creating the plugin from the Maven archetype.
Plugin layout
Examine the structure of the built plugin. From the terminal:
Change to the target/<version>
folder and examine the file structure. title-prefix-plugin/target/1.0.0
:
1.0.0 |- libs |- title-prefix-plugin-1.0.0.jar
This is a very simple plugin that contains only a single jar file in the libs folder. More complicated plugins that depended on third party libraries might include jar file for other dependencies.
Packaging into an archive
Funnelback expects the installed plugin to follow a specific folder structure, based on the name and version of the plugin. The title-prefix-plugin
should have the following structure:
$SEARCH_HOME/share/plugins |- title-prefix-plugin (our plugin) |- 1.0.0 |- libs |- title-prefix-plugin-1.0.0.jar
This mirrors the structure of the plugin built above. In order to make distribution easier package this into a single .tar.gz
file using the following commands:
$ cd target
$ mkdir title-prefix-plugin
$ cp -R 1.0.0 title-prefix-plugin
$ tar -czvf title-prefix-plugin-1.0.0.tar.gz title-prefix-plugin
This will produce:
title-prefix-plugin-1.0.0.tar.gz