Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] Unable to Override m2e lifecycle-mapping in Child pom.xml

Matthew,

many thanks for your quick reply. :-)

Am 03.05.2019 um 16:26 schrieb Matthew Piggott:
Have you tried looking at maven's combine attributes? https://blog.sonatype.com/2011/01/maven-how-to-merging-plugin-configuration-in-complex-projects/
Indeed, I had not done so before I sent my initial mail (I wasn't even aware of the fact that these attributes existed), but I have checked your proposal now:

Unfortunately, it looks like the "combine.*" attributes do NOT work on the m2e lifecycle mapping plugin fragments - I now get the following error message in "Markers" section "Maven Problems (1 item)":

Cannot parse lifecycle mapping metadata for maven project MavenProject: our_group_id:our_artifact_id:our_version @ D:\our\path\to\the\pom.xml Cause: Unknown attribute 'combine.self' for tag 'lifecycleMappingMetadata' (position: START_TAG seen ...ding="UTF-8"?>\r\n<lifecycleMappingMetadata combine.self="override">... @2:51)

(replaced real group/artifact name/version/path name from our project by dummy names...)

My own pom.xml section now looks like the following (while the immutable read-only parent pom contains a similar section with action "ignore" in its pluginManagement section):

               <plugin>
                  <groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>${version.lifecycle-mapping.plugin}</version>
                  <configuration>
                    <lifecycleMappingMetadata combine.self="override">
                           <pluginExecutions>
                              <pluginExecution>
                                 <pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<versionRange>[${version.maven-assembly.plugin},)</versionRange>
                                   <goals>
<goal>single</goal>
                                   </goals>
                                </pluginExecutionFilter>
                                 <action>
                                   <execute>
<runOnConfiguration>true</runOnConfiguration>
<runOnIncremental>true</runOnIncremental>
                                   </execute>
                                 </action>
                              </pluginExecution>
                           </pluginExecutions>
                    </lifecycleMappingMetadata>
                  </configuration>
               </plugin>

So I assume that XML parsing for the special, "virtual" m2e lifecycle-mapping plugin does not take these special attributes into account :-(

How can we proceed from here?

Thanks a million one more time! :-)
Andreas (awl)



Back to the top