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
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.
Check the documentation file
The mvn command above also generates an index.adoc
file to src/main/resources/
. Open this file inside IntelliJ and check it for errors and readability.
If you find any formatting issues or need to update any of the text, edit the relevant include file or PluginUtils.java
then run the mvn
command again.
Use the preview window in IntelliJ to check the asciidoc file for formatting issues. |
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/target/1.0.0
:
1.0.0 |- libs |- title-prefix-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
should have the following structure:
$SEARCH_HOME/share/plugins |- title-prefix-plugin (our plugin) |- 1.0.0 |- libs |- title-prefix-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
$ cp -R 1.0.0 title-prefix
$ tar -czvf title-prefix-1.0.0.tar.gz title-prefix
This will produce:
title-prefix-1.0.0.tar.gz