Friday, April 30, 2010

RHQ/Jopr plugin development and versions

Recently a user showed up on IRC and said he had written a plugin and that deploying it is throwing this error:

2010-04-30 14:26:10,601 WARN [org.rhq.enterprise.server.core.plugin.AgentPluginDeploymentScanner] Failed to scan plugin [...../myPlugin-1.0.jar] found on filesystem. Skipping it.

Cause: java.lang.Exception: No version is defined for plugin jar [..../myPlugin-1.0.jar]. A version must be defined either via the MANIFEST.MF [Implementation-Version] attribute or via the plugin descriptor 'version' attribute.


While the error message is accurate, it is still not obvious, what is going on, as most of the plugins in the RHQ source tree do not explicitly set a version number.

As the message says you need to:

  • either explicitly set a version in the plugin descriptor like

    <plugin name="myPlugin" version="1.2.3" ... >

  • or tell maven to add a Specification-Version: in MANIFEST.MF, which automatically happens when you have the rhq-parent pom as (indirect) parent of your pom, which then contains this:
    <plugin>

    <artifactId>maven-jar-plugin</artifactId>

    <configuration>

    <archive>

    <manifest>

    <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>



In most cases, following the RHQ-version is easiest, as you don't have to do anything. If you want to do release-cycles outside of RHQ, the explicit version is for sure better.

1 comment:

Alejandro Montenegro said...

Thanks for the help solving this issue