I created a new library like you suggested, and modified both the checkstyle
an pmd plugins to use it by adding the new library as a dependency. When I
run them individually everything works fine and I see their metrics being
reported, but when I try to run both in the same build, I only see the
metrics of the last plugin run (in my case checkstyle).

I think this has to do with classloading and the way plexus loads its
components. The metrics library has a components.xml file in its jar, so I
think that the registry singleton is being created by the plugin
classloader.

What would be the best way to ensure that the registry is a singleton for
the build?

Here's my components.xml:

<component-set>
  <components>
    <component>
      <role>org.apache.maven.metrics.MetricRegistry</role>
      <implementation>org.apache.maven.metrics.DefaultMetricRegistry
</implementation>
    </component>
  </components>
</component-set>


Mauro

On 2/19/06, Brett Porter <[EMAIL PROTECTED]> wrote:
>
> It would just need to be a common dependency. reporting-api definitely
> is, but you could easily create a new library for it (and that probably
> makes more sense).
>
> The component definition goes in the same JAR as the class.
>
> - Brett
>
> Mauro Botelho wrote:
> > Brett, in order for any plug-in to use the MetricRegistry, would it have
> to
> > be declared in the reporting-api? Where would I add the component
> definition
> > for it?
> >
> > Mauro
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to