M2 Eclipse Plugin Execution Not Covered

Source: Internet
Author: User

M2 Eclipse Plugin Execution Not Covered

 

Maven projects have multiple phases (phase) in the build process, and each stage has a specific goal (goal) to execute. M2Eclipse 0.12 and earlier versions define the implementation goals of Maven projects in eclipse at each stage. The error "Plugin execution not covered" occurs because the configured plug-in execution (goal) does not find the corresponding lifecycle ing behavior in the ing metadata sources (which is execution? Or not ?), That is to say, this m2e does not know whether to execute this goal.

Some of these goals are configured at the workspace level, and some are in project/. settings. But the problem is that these goals are not effective for all projects. Therefore, we had to refresh or update dependencies, update configurations, and rebuild the projects to a good state.

There are two main causes of these problems:

1. The Maven Plug-In constructs resources that are not in the workspace. In some cases, the project is normal, and in some cases, the resources are missing;

2. Leakage of JVM and OS resources caused by Maven plug-ins may also cause these problems.

Lifecycle ing

To solve problems caused by goals failure, a project build lifecycle ing or lifecyclemapping is used in M2Eclipse 1.0) command configuration to define how to map pom. the information in xml corresponds to the behavior of the Eclipse workspace build.

 

Project Construction lifecycle ing can be configured in the pom. xml file of the project, provided by the Eclipse plug-in, or Maven plug-in provided by m2e by default. The life cycle ing source is called lifecycle mapping metadata sources ). If no corresponding lifecycle ing is found in these lifecycle ing metadata sources, m2e creates an error marker similar to the following ):

For plug-in execution, m2e provides three basic actions: ignore, execute, or delegate to the project configurator ). These three action options correspond to the ing column in the lifecycle ing table. Delegate to project configurator)

Configuring program ing tells m2e how to delegate the project configuration ing of the workspace used to match the execution of the plug-in to the implementation of AbstractProjectConfigurator (using projectConfigurators extension point registration. In most cases, this behavior is used by m2e extension developers.

Ignore

This option tells m2e to ignore the execution of this plug-in.

<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>

In addition, M2e provides a simple and fast solution to the problem of plugin execution not covered:

 

Use <pluginManagement/> to enclose plugins

 

Execute

 

This option tells m2e that this behavior will be executed as part of the full or incremental structure of the Eclipse workspace.

<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>                <runOnIncremental>false</runOnIncremental>              </execute>            </action>          </pluginExecution>        </pluginExecutions>      </lifecycleMappingMetadata>    </configuration>    </plugin>  </plugins></pluginManagement>

The quick solution is to create an ignore ing and replace <ignore/> with <execute/>. By default, runOnIncremental is set to false for M2e 1.3 and later versions.

 

Metadata sources search order

1. pom. xml of the project

2. the pom. xml of the Parent Project, the pom. xml of the grandfather project, and so on.

3. M2Eclipse 1.2 + workspacepreferences

4. Installed M2Eclipse extensions (no specific order)

5. M2Eclipse1.1 + lifecycle mapping metadata provided by Maven plug-in

6. Default lifecyclemapping metadata provided by M2Eclipse

M2Eclipse uses the first available ing found.

Lifecycle ing metadata provided by Maven plug-in

From m2e 1.1, maven plug-in developers can provide the life cycle metadata in the plug-in.

This step reduces many of our requirements for plug-in configuration in pom. xml.

M2Eclipse 1.2 + workspace preferences

From M2Eclipse 1.2, you can configure the lifecycle ing metadata in the workspace preferences option, and the Workspace-level plug-in targets can be directly ignored using quick-fix. You can view the parameters through Preferences> Maven> LifecycleMappings.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.