Skip to main content
Jump to: navigation, search

Difference between revisions of "M2E plugin execution not covered"

(Replaced content with "[https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html This page is now here]")
 
(34 intermediate revisions by 9 users not shown)
Line 1: Line 1:
[[Category:M2E]]
+
[https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html This page is now here]
 
+
=== Background ===
+
To solve some long-standing issues, m2e 1.0 requires explicit instructions what to do with all Maven plugins bound to "interesting" phases (see [[M2E interesting lifecycle phases]]) of project build lifecycle. We call these instructions "project build lifecycle mapping" or simply "lifecycle mapping" because they define how m2e maps information from project pom.xml file to Eclipse workspace project configuration and behaviour during Eclipse workspace build.
+
 
+
Project build lifecycle mapping configuration can be specified in project pom.xml, contributed by Eclipse plugins and there is also default configuration for some commonly used Maven plugins shipped with m2e. We call these "lifecycle mapping metadata sources". m2e will create error marker like below for all plugin executions that do not have lifecycle mapping in any of the mapping metadata sources.
+
<pre>Plugin execution not covered by lifecycle configuration:
+
org.apache.maven.plugins:maven-antrun-plugin:1.3:run
+
    (execution: generate-sources-input, phase: generate-sources)
+
</pre>
+
m2e matches plugin executions to actions using combination of plugin groupId, artifactId, version range and goal. There are three basic actions that m2e can be instructed to do with a plugin execution -- '''ignore''', '''execute''' and delegate to a project '''configurator'''.
+
 
+
 
+
=== ignore plugin goal ===
+
 
+
'''ignore''', as the name suggests, tells m2e to silently ignore the plugin execution. Here is sample pom.xml snippet
+
 
+
    <pluginManagement>
+
      <plugins>
+
        <plugin>
+
          <groupId>org.eclipse.m2e</groupId>
+
          <artifactId>lifecycle-mapping</artifactId>
+
          <version>1.0.0</version>
+
          <configuration>
+
            <lifecycleMappingMetadata>
+
              <pluginExecutions>
+
                <pluginExecution>
+
                  <pluginExecutionFilter>
+
                    <groupId>some-group-id</groupId>
+
                    <artifactId>some-artifact-id</artifactId>
+
                    <versionRange>[1.0.0,)</versionRange>
+
                    <goals>
+
                      <goal>some-goal</goal>
+
                    </goals>
+
                  </pluginExecutionFilter>
+
                  <action>
+
                    <ignore />
+
                  </action>
+
                </pluginExecution>
+
              </pluginExecutions>
+
            </lifecycleMappingMetadata>
+
          </configuration>
+
        </plugin>
+
      </plugins>
+
    </pluginManagement>
+
 
+
 
+
HINT: m2e provides a quick-fix associated with "plugin execution not covered" to easily create <pluginManagement/> elements like above.
+
 
+
=== execute plugin goal ===
+
 
+
'''execute''' tells m2e to execute the action as part of Eclipse workspace full or incremental build. Beware that m2e does not provide any safeguards against rouge maven plugins that leak classloaders, modify random files inside workspace or throw nasty exceptions to fail the build. Use this as the last resort and make sure you know what you are doing.
+
 
+
    <pluginManagement>
+
      <plugins>
+
        <plugin>
+
          <groupId>org.eclipse.m2e</groupId>
+
          <artifactId>lifecycle-mapping</artifactId>
+
          <version>1.0.0</version>
+
          <configuration>
+
            <lifecycleMappingMetadata>
+
              <pluginExecutions>
+
                <pluginExecution>
+
                  <pluginExecutionFilter>
+
                    <groupId>some-group-id</groupId>
+
                    <artifactId>some-artifact-id</artifactId>
+
                    <versionRange>[1.0.0,)</versionRange>
+
                    <goals>
+
                      <goal>some-goal</goal>
+
                    </goals>
+
                  </pluginExecutionFilter>
+
                  <action>
+
                    <execute />
+
                  </action>
+
                </pluginExecution>
+
              </pluginExecutions>
+
            </lifecycleMappingMetadata>
+
          </configuration>
+
        </plugin>
+
      </plugins>
+
    </pluginManagement>
+
 
+
 
+
HINT: use quick fix to create "ignore" mapping, then replace <ignore/> action with <execute/>
+
 
+
=== delegate to a project'''configurator''' ===
+
 
+
configurator tells m2e to delegate workspace project configuration mapping for matching plugin executionы to an implementation of AbstractProjectConfigurator registred with m2e using projectConfigurators extension point.
+
 
+
In most cases configurator mapping will be used by m2e extension developers
+
 
+
=== metadata source lookup order ===
+
 
+
m2e considers lifecycle mapping metadata sources in the following order
+
 
+
1. pom.xml file of the project
+
2. parent, grand-parent and so on pom.xml files
+
3. installed m2e extensions (in no particular order)
+
4. default lifecycle mapping metadata shipped with m2e
+
 
+
m2e uses the first applicable mapping.
+
 
+
== Help improve m2e maven plugin coverage ==
+
 
+
First and foremost, you need to understand the desired behaviour. In most cases this should be limited to IDE usecase, i.e. editing sources and running tests, and not the complete Maven build, so plugin goals that publish build results to a remote repository can be ignored without any adverse side effects, while java source code generation most like is necessary.
+
 
+
If the desired behaviour is applicable to other Maven projects using the plugin goal, we strongly recommend documenting your findings in m2e bugzilla.  Please use "[mojo] plugin-artifact-id:goal support" bugzilla summary and make sure to search for existing records. When submitting new request, please provide standalone example project and detailed description of desired behaviour when the project is imported in Eclipse workspace. This will allow other users and interested developers to track popularity of various Maven plugins and schedule implementation work accordingly.
+
 
+
[M2E Extension Development] has pointers how to develop m2e extensions.
+

Latest revision as of 07:13, 14 November 2014

This page is now here

Back to the top