maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Tran <dant...@gmail.com>
Subject Re: Singleton component
Date Tue, 29 Jul 2014 15:12:47 GMT
http://maven.40175.n5.nabble.com/problem-Maven-creates-the-second-plugin-classloader-during-parallel-build-and-uses-two-classloader-hy-td5713793.html


https://cwiki.apache.org/confluence/display/MAVEN/Maven+3.x+Class+Loading

May help

-d
On Tuesday, July 29, 2014, <dirk.mahler@buschmais.com> wrote:

> Hi,
>
> during the developing a Maven plugin (Maven project API version 3.0.5) for
> the project jQAssistant (jqassistant.org) and I'm running into an issue
> where I need some help:
>
> The plugin mojo scans the artifacts generated by the build process
> (classes, etc.) into an embedded instance of the graph database Neo4j to
> provide the base for further analysis. As starting and shutting down the
> database instance is quite expensive I would like to re-use a cached
> instance for multi-module projects.
>
> I'm trying to hold this instance in singleton class:
>
> @org.codehaus.plexus.component.annotations.Component(role =
> StoreProvider.class, instantiationStrategy = "singleton")
> public class StoreProvider implements Disposable {
> ...
> }
>
> and inject it into my Mojo using
>
> @org.apache.maven.plugins.annotations.Component;
> private StoreProvider storeProvider;
>
> For several project structures I can see that multiple instances of the
> singleton are created which breaks the contract I was hoping I could
> establish (the database complains that there's already a running
> instance).
>
> It seems that this bevahior is related to the presence of some specific
> plugins in the multi-module project to be scanned:
>
> <groupId>org.codehaus.sonar</groupId>
> <artifactId>sonar-packaging-maven-plugin</artifactId>
> <version>1.9</version>
> <extensions>true</extensions>
>
> How can I solve this problem?
>
> Thanks in advance,
>
> Dirk
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org <javascript:;>
> For additional commands, e-mail: dev-help@maven.apache.org <javascript:;>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message