The Skeleton Plugin is a project stub on which new plugins can be easily written. It includes the following:
- The basic file structure required for a plugin.
- Maven POM file necessary to build the project, placing the necessary files in their correct locations. This POM file is configured to use the RHQ Plugin Validator as well.
- A stubbed out plugin descriptor with comments guiding how to get started.
- Code samples demonstrating how to use the required API interfaces.
- IDE project files for Eclipse and IntelliJ.
The simplest way is to copy the directory structure and begin to edit as necessary. In other words, the contents of the skeleton-plugin directory may be copied to another directory to serve as the basis for the new plugin. If you are unfamiliar with using Maven for builds, check their site for more information.
The following checklist describes areas in the Skeleton Plugin to be edited:
Changes to the pom.xml file
- Rename the artifactId and groupId
- Change the name attribute to reflect the new plugin
- Optional: Change the description attribute to reflect the new plugin
- Optional: Select a logging framework dependency (see descriptor for more details)
- Optional: Add any dependencies the new plugin requires
Remove or rename and modify the sample resource types from the plugin descriptor
Once the references to the sample code components are removed from the plugin descriptor, those classes may be deleted
Once the plugin code has been added, the plugin can be built using the following maven command:
The plugin will be created in the target directory with the following name:
Once the plugin has been built, the validator can be used to ensure the integrity of the descriptor and class files.
Get the most up-to-date version of the plugin by simply getting this maven module from git: http://git.fedorahosted.org/git/?p=rhq/rhq.git;a=tree;f=etc/samples/skeleton-plugin;hb=refs/heads/master
The 1.0.0.GA version of the skeleton plugin can be downloaded here.