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.mah...@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-unsubscr...@maven.apache.org <javascript:;> > For additional commands, e-mail: dev-h...@maven.apache.org <javascript:;> > >