Hello,

I'd like to create a maven plugin that provides a custom lifecycle mapping 
(META-INF/plexus/components.xml) for a custom packaging type that maps other 
maven plugins' goals to lifecycle phases and then to use the created maven 
plugin in a project - what's a so common scenario.

The plugin configuration propagates well to its own mojos, but does not to the 
other dependent maven plugins' mojos.

If the above issue description is not so clear, the concrete issue may be seen 
on my github fork: [1]

short sample explanation:
- plugin-a has the mojo class: [2]
- plugin-b defines the lifecycle mapping: [3]
- project references to project-b and provides the plugin configuration: [4]
- and the issue is that the provided plugin configuration is not passed to the 
mojo class: [2]

and so, how I think the issue may be solved:
- add a originPlugin (org.apache.maven.model.Plugin) field to the LifecycleMojo
- afterward merge originPlugin's configuration to a created PluginExecution 
from the LifecycleMojo

because the connection between the maven plugin that provides a custom 
lifecycle mapping and the defined lifecycle mojos does not exist at the moment 
during runtime

An alternative solution may be to copy, or to subclass the mojos to the new 
maven plugin, but I'd rather consider a 'cleaner' solution.

WDYT?

Regards,
Mario

[1] 
https://github.com/mkrizmanic/maven-integration-testing/commit/58b0af38da1174e7c415d041d0c4e8a203ff95cb
 
<https://github.com/mkrizmanic/maven-integration-testing/commit/58b0af38da1174e7c415d041d0c4e8a203ff95cb>
[2] 
https://github.com/mkrizmanic/maven-integration-testing/blob/MNG-9999/core-it-suite/src/test/resources/mng-9999/plugin-a/src/main/java/org/apache/maven/its/mng9999a/plugin/TestMojo.java
 
<https://github.com/mkrizmanic/maven-integration-testing/blob/MNG-9999/core-it-suite/src/test/resources/mng-9999/plugin-a/src/main/java/org/apache/maven/its/mng9999a/plugin/TestMojo.java>
[3] 
https://github.com/mkrizmanic/maven-integration-testing/blob/MNG-9999/core-it-suite/src/test/resources/mng-9999/plugin-b/src/main/resources/META-INF/plexus/components.xml
 
<https://github.com/mkrizmanic/maven-integration-testing/blob/MNG-9999/core-it-suite/src/test/resources/mng-9999/plugin-b/src/main/resources/META-INF/plexus/components.xml>
[4] 
https://github.com/mkrizmanic/maven-integration-testing/blob/MNG-9999/core-it-suite/src/test/resources/mng-9999/project/pom.xml
 
<https://github.com/mkrizmanic/maven-integration-testing/blob/MNG-9999/core-it-suite/src/test/resources/mng-9999/project/pom.xml>




Reply via email to