Hi Martin,
Plugin A has several executions defined with different configurations.
Here's an example of such a configuration (from the <build><plugins>-part):
<execution>
<id>aspectJ-weaving-execution</id>
<phase>compile</phase>
<goals>
<goal>executePlugin</goal>
</goals>
<configuration>
<pluginExecutionIds>
<pluginExecutionId>aspectJ-weaving</pluginExecutionId>
</pluginExecutionIds>
<pomPackagings>
<pomPackaging>jar</pomPackaging>
<pomPackaging>war</pomPackaging>
<pomPackaging>ejb</pomPackaging>
</pomPackagings>
<pomProperties>
<property>
<name>doAspectJWeaving</name>
<value>true</value>
</property>
</pomProperties>
</configuration>
</execution>
Plugin A will check the current project to see whether it is of pomPackaging
type jar/war or ejb or if the project contains the property doAspectJWeaving
with the value true. If one of these conditions is met plugin A decides to
execute the <pluginExecutionId>aspectJ-weaving</pluginExecutionId>.
Here's the configuration for the pluginExecution = aspectJ-weaving from the
<build><pluginManagement>-part:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.4</version>
<configuration>
<complianceLevel>1.5</complianceLevel>
<verbose>true</verbose>
<showWeaveInfo>true</showWeaveInfo>
<proceedOnError>false</proceedOnError>
<aspectLibraries>
<aspectLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</aspectLibrary>
</aspectLibraries>
</configuration>
<executions>
<execution>
<id>*aspectJ-weaving*</id>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
However plugin B needs access to the MavenProject or MavenSession instance
to retrieve some maven info but since these dependencies are not injected a
NullPointerException (or if @required was defined a missing parameter) will
be thrown.
Beware that I used an example for Plugin B which is an existing plugin where
we do not have the sources of. But this also holds for plugin that we
created ourselves.
Any help appreciated.
Regards,
Richard
--
View this message in context:
http://maven.40175.n5.nabble.com/MavenProject-MavenSession-not-injected-when-executing-plugin-from-a-plugin-tp5716570p5717095.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]