Not sure about your questions, but your finding might explain (or be related) ti what was found by Karl in this thread
http://markmail.org/thread/65b7o4so77i7delc Thanks, ~t~ On Wed, Mar 12, 2014 at 10:45 AM, Julien CARSIQUE <jcarsi...@nuxeo.com>wrote: > Hi, > > I recently discovered an issue between the "deployAtEnd" option of > "maven-deploy-plugin" and the execution of my plugin > "ant-assembly-maven-plugin" (based on Aether). > > I first though it had nothing to do with maven-deploy-plugin and revealed > a more general issue in my implementation, so > I posted on Aether mailing list [0] but Benjamin Bentmann answered it > could be a bug in the maven-deploy-plugin > implementation of deployAtEnd option [1]: > >> Aether has nothing to do with the way Maven manages class loaders for > plugins, i.e. you should reach out to the Maven > user list instead. > >> Also, your analysis suggests a bug in the maven-deploy-plugin in that > it relies on the erroneous assumption that a > single class loader is used per plugin through out a multi-module build. > > Here it the issue: the deployAtEndoption doesn't work after building a > module involving an execution of > ant-assembly-maven-pluginbecause a new "Class realm plugin" is then > created and its static fields are reset (in that > case, the > org.apache.maven.plugin.deploy.DeployMojo.readyProjectsCounterfield). > > Code from maven-deploy-plugin(readyProjectsCounterrestarted to zero will > never equal to reactorProjects.size(), > projectsReadywill be always false): > > @Parameter( defaultValue = "${reactorProjects}", required = true, > readonly = true ) > private List<MavenProject> reactorProjects; > > private static final AtomicInteger readyProjectsCounter = new > AtomicInteger(); > > * *org.apache.maven.plugin.deploy.DeployMojo.execute() { > boolean projectsReady = readyProjectsCounter.incrementAndGet() == > reactorProjects.size(); > > > In the following sample case, the ant-assembly-maven-plugin is called by > the "nuxeo-distribution-resources" module. > After that, no deployment will ever happen since the static fields of > maven-deploy-plugin are reset, the counter > "readyProjectsCounter" restarted to zero will never reach the number of > "reactorProjects", "projectsReady" will be > always false: > > $ mvn clean deploy -Pqa -DskipTests -pl > nuxeo-functional-tests,nuxeo-launcher,nuxeo-distribution-resources -nsu > -X|grep maven-deploy-plugin > > [DEBUG] Goal: > org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy (default-deploy) > [INFO] --- maven-deploy-plugin:2.8.1:deploy (default-deploy) @ > nuxeo-functional-tests --- > [DEBUG] org.apache.maven.plugins:maven-deploy-plugin:jar:2.8.1: > [DEBUG] *Created new class realm > plugin>org.apache.maven.plugins:maven-deploy-plugin:2.8.1* > [DEBUG] Importing foreign packages into class realm > plugin>org.apache.maven.plugins:maven-deploy-plugin:2.8.1 > [DEBUG] Populating class realm > plugin>org.apache.maven.plugins:maven-deploy-plugin:2.8.1 > [DEBUG] Included: org.apache.maven.plugins:maven-deploy-plugin:jar:2.8.1 > [DEBUG] Configuring mojo > org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy from plugin realm > ClassRealm[plugin>org.apache.maven.plugins:maven-deploy-plugin:2.8.1, > parent: sun.misc.Launcher$AppClassLoader@4821e115] > [DEBUG] Configuring mojo > 'org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy' with basic > configurator --> > [DEBUG] Goal: > org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy (default-deploy) > > [INFO] --- maven-deploy-plugin:2.8.1:deploy (default-deploy) @ > nuxeo-launcher --- > [DEBUG] Configuring mojo > org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy from plugin realm > ClassRealm[plugin>org.apache.maven.plugins:maven-deploy-plugin:2.8.1, > parent: sun.misc.Launcher$AppClassLoader@4821e115] > [DEBUG] Configuring mojo > 'org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy' with basic > configurator --> > [DEBUG] Goal: > org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy (default-deploy) > > [INFO] --- maven-deploy-plugin:2.8.1:deploy (default-deploy) @ > nuxeo-distribution-resources --- > [DEBUG] org.apache.maven.plugins:maven-deploy-plugin:jar:2.8.1: > [DEBUG] *Created new class realm > plugin>org.apache.maven.plugins:maven-deploy-plugin:2.8.1--724569306* > [DEBUG] Importing foreign packages into class realm > plugin>org.apache.maven.plugins:maven-deploy-plugin:2.8.1--724569306 > [DEBUG] Populating class realm > plugin>org.apache.maven.plugins:maven-deploy-plugin:2.8.1--724569306 > [DEBUG] Included: org.apache.maven.plugins:maven-deploy-plugin:jar:2.8.1 > [DEBUG] Configuring mojo > org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy from plugin realm > ClassRealm[plugin>org.apache.maven.plugins:maven-deploy-plugin:2.8.1--724569306, > parent: sun.misc.Launcher$AppClassLoader@4821e115] > [DEBUG] Configuring mojo > 'org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy' with basic > configurator --> > > Could someone explain or guess why/when a "new class realm > plugin>org.apache.maven.plugins:maven-deploy-plugin" is > created (in bold) instead of reusing the previous one? > Is there something wrong in my implementation about that? Or should I > rather create an > http://jira.codehaus.org/browse/MDEPLOY issue related to MDEPLOY-157? > > The full log of above reproduction case: > http://ubuntuone.com/0WeyQGBzaDacZWh97CwcvE > The ant-assembly-maven-plugin source code: > https://github.com/nuxeo/ant-assembly-maven-plugin > Issue management: > - https://jira.nuxeo.com/browse/NXBT-739 (Do not break depoyAtEnd option > of maven-deploy-plugin) > - http://jira.codehaus.org/browse/MDEPLOY-157 (Add deployAtEnd option for > multimodule projects) > > Thanks, > > [0] http://dev.eclipse.org/mhonarc/lists/aether-users/msg00385.html > [1] http://dev.eclipse.org/mhonarc/lists/aether-users/msg00386.html > > > -- > > *Julien Carsique* > DevOps Nuxeo, Paris, France > >