Installing a Plug-in from Its Sources
Now that you know how to write a plug-in, let's install your newly created Jarexec plug-in in your local Maven installation.
How do I do that?
A plug-in is packaged as a JAR, so the first step is to configure the Jarexec project's build so that it generates a valid plug-in JAR. A valid plug-in JAR must contain some requisite files: plugin.jelly, plugin.properties, and (optionally) plug-in resources. Plug-in resources, as you will see in a following lab, are simply any file that is put in a plugin-resources/ directory in the JAR.
You create a plug-in JAR by calling the plugin:plugin
goal of the Plugin plug-in. In
practice, this goal simply calls the jar:jar
goal internally. To generate a valid
JAR configure your jarexec/project.xml file and define a
resources
section to include
plugin.jelly, plugin.properties, and any plug-in
resources in your plug-in's JAR file:
<?xml version="1.0"?> <project> <pomVersion>3</pomVersion> <artifactId>jarexec</artifactId> <name>JAR Executor</name> <groupId>mdn</groupId> [...] <build> <sourceDirectory>src/main</sourceDirectory> <unitTestSourceDirectory>src/test</unitTestSourceDirectory> <unitTest> <includes> <include>**/*Test.java</include> </includes> </unitTest> <resources> <resource> <directory>src/plugin-resources</directory> <targetPath>plugin-resources</targetPath> </resource> <resource> <directory>.</directory> <includes> <include>plugin.jelly</include> <include>plugin.properties</include> <include>project.xml</include> ...
Get Maven: A Developer's Notebook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.