JBoss Community Archive (Read Only)


Maven plugin for RHQ agent plugin


As of today, to develop an RHQ agent plugin with Maven one has to use the standard JAR packaging and declare many different Maven plugins executions (like Dependency Plugin or ANT Plugin) to implement things like:

  • copying dependencies somewhere in the build directory

  • deploying the agent plugin to a development container

  • setting up integration tests with a standalone plugin container

It would be nice to have a custom Maven packaging for agent plugins and a set of mojos to get (at least) the same things done with only a few lines of configuration.


A prototype is on Github: https://github.com/tsegismont/rhq-agent-plugin-plugin

It now less of a prototype and has moved to the RHQ Project Organization on Github: https://github.com/rhq-project/rhq-agent-plugin-plugin

Rhq Agent Plugin plugin

Custom packaging vs reusable assembly

With Maven, one way to describe a custom packaging is to create and share an assembly descriptor, as described in the Maven documentation. But this is less powerful than a "native" custom Maven packaging which can take control of the build lifecycle (custom phases).


A mojo is the implementation of a Maven goal see Introduction to Maven 2.0 Plugin Development.


The packaging mojo takes care of the plugin archive creation. Like the war mojo does, the rhq-agent-plugin mojo should be able to determine the dependencies of scope RUNTIME required by the agent plugin and automatically add them under the lib/ directory of the archive.

In the prototype, the main project artifact is the plugin archive. This means that what you will find in Maven repositories is the plugin archive embedding its dependencies, not a simple JAR of the plugin classes. It's possible in the future to add a parameter to attach a JAR of classes (with classifier) to the list of project artifacts.

Note that the prototype make uses of the Maven Archiver utility. This will allow the RHQ team to conform with the JBoss.org standard for manifest file entries.


Deployment to a development container

The prototype has a mojo which can deploy the built archive to a local development container. It is not activated (bound to a phase) by default.

Deployment to a test server (not implemented) available in v0.3

It would be nice to be able to deploy the plugin archive to a remote RHQ server (needs to add plugin deployment feature to the REST API).

Project generator (not implemented)

It's possible to create a mojo which does not require an existing project. We could use this feature to generate a skeleton project. One would type:

mvn org.rhq:agent-plugin-gen [-Ddescriptor-file=/path/to/rhq-plugin.xml] [-DoutputDir=/path/to/the/new/plugin/project]

And would get a Maven project generated with a pre-configured POM and skeleton component and discovery classes.

The code of the plugin-gen helper might be reused here.

Plugin doc generator (not implemented)

The agent plugin descriptor schema allows to add help sections as html. There is a plugin documentation generator tool which can be reused / repackaged in this plugin.

This would not be activated by default.

Plugin validator (not implemented) available in v0.3

There is a plugin validator tool which can be reused / repackaged in this plugin.

This would not be activated by default Once the goal is added to the execution list, it is activated, but there is a failOnError property which might be useful.

Integration test setup (not implemented)

This mojo would prepare in the build directory a standalone plugin container for integration tests. The platform plugin and the Sigar libraries would be there.

Most of the plugins maintained by the RHQ team use this standalone container technique. We might still prefer to favor the usage of the Arquillian Integration For Agent Plugins in the future.

Archetypes (not implemented)

Maven archetypes have very limited features: they only allow to template the creation of a project, as explained in the Introduction to Archetypes.

Still they are very easy to create: you setup a model project and then ask Maven to create an archetype from this model

We might prepare an archetype for:

  • a standard agent plugin

  • a plugin depending on the JMX plugin

Both would generate a project with pre-configured custom packaging and pre-configured plugin mojos executions.

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-11 12:57:34 UTC, last content change 2013-10-25 10:19:54 UTC.