Thank you all for your replies.

@mgainty
I tried to show you how things were set up on my part and send you only some
snippets of my configuration. Maybe this led to some confusion. Therefore I
will try to give some additional info to show how things are setup:

In the build-plugin part of our pom.xml we've specified a plugin that we
developed ourselves which is able to execute other plugins. We call it the
pluginutils-plugin and in the example is referred to as Plugin A. 
This is a normal maven plugin with one goal named executePlugin. Also the
plugin.xml is generated as supposed to.

This plugin has some executions attached to it and one of them is the
<id>aspectJ-weaving-execution</id>
This execution also has some other parameters like pomProperties and
pomPackagings. But the most important parameter is the list of executionId's
as defined like this:

        <pluginExecutionIds>
           <pluginExecutionId>aspectJ-weaving</pluginExecutionId>
        </pluginExecutionIds>

The executionId's that are defined here must match with executionId's as
defined in the build-pluginManagement-Part of our pom. In this part we've
specified several plugins (existing plugins like the aspectj-maven-plugin
but also plugins that we've developed ourselves).

Once the pluginutils-plugin is triggered it will use it's configuration and
verifies if the project/module that is build satisfies one of the properties
specified. So it will check whether the property doAspectJWeaving is set to
true for this project or whether this project is of type war/ejb or jar. If
this is the case it will then check the list with all plugins that are
configured and will try to find the executionId (in this case
aspectJ-weaving). If there's a match it will start the executeMojo on that
plugin.

In Maven2 all other plugins (in the example referred to as plugin B or
C/D/E/F etc) executed normally and all Maven related information (like
MavenProject and MavenSession) was injected correctly. However after
switching to Maven 3 builds failed because of missing required parameters
(or nullpointerexceptions if required annotation was not specified).

As I understood from Martin Eisengardt this has to with the fact that the
PlexusContainer does not have maven related information since Maven 3. 

Right now I'm looking into the source code of Maven to see how plugins are
executed.

Regards,
Richard




--
View this message in context: 
http://maven.40175.n5.nabble.com/MavenProject-MavenSession-not-injected-when-executing-plugin-from-a-plugin-tp5716570p5717245.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to