M2eclipse 0.12 and earlier releases will perform part of the lifecycle of the MAVEN creation lifecycle in Eclipse, and will reconfigure the Eclipse project based on the post-execution state of Mavenproject. These processes are controlled by goals, and some of these goals are configured at the workspace level, some in project/.settings.
The problem is that this does not work for all projects , so we have to refresh or update the dependencies, update the configuration and recreate them to make the project a good state. There are two main causes of these problems:
1. The Maven plugin creates some resources that are not in the workspace (workspace), in some cases the project is not a problem, in some cases it is considered a lack of resources;
2. Resource leaks from the JVM and the OS caused by Maven plugins can also cause these problems.
Life cycle Mapping
To solve this problem, starting with M2eclipse 1.0, a project build lifecycle mapping was used, mapping) or life cycle mapping (lifecyclemapping), which defines how the information in Pom.xml maps to the behavior of the Eclipse workspace Creation (workspace build).
The project creation lifecycle mapping can be configured in the project's Pom.xml file, or provided by the Eclipse plug-in, or by default with the Maven plugin provided by M2E. The Life cycle mapping source We call the life cycle mapping Meta data source (lifecycle mapping metadata sources). If the corresponding life cycle mappings are not found in these life cycle mapping metadata sources, M2E creates an error token similar to the following (Error marker):
For plug-in execution, M2E provides three basic behaviors: Ignore, execute, or delegate to the project configuration Program (Configurator). These three behavior options correspond to the mapping columns in the Life cycle mapping table.
Delegate to Project Configurator (Configurator)
The configuration program mapping tells M2E how to delegate the implementation of the workspace project configuration mapping work that is used to match the plug-in execution to Abstractprojectconfigurator (using the projectconfigurators extension Point registration) to complete. In most cases, this behavior is used by m2e Extension (extension) developers .
Ignore
This option will tell m2e to ignore this plugin execution.
<pluginManagement> <plugins> <plugin> <groupId>org.eclipse.m2e</groupId> <artif actid>lifecycle-mapping</artifactid> <version>1.0.0</version> <configuration> <li fecyclemappingmetadata> <pluginExecutions> <pluginExecution> <pluginexecution Filter> <groupId>some-group-id</groupId> <artifactid>some-artifact-id</a Rtifactid> <versionrange>[1.0.0,) </versionRange> <goals> < ;goal>some-goal</goal> </goals> </pluginExecutionFilter> <actio N><ignore/></action> </pluginExecution> </pluginExecutions> </lifecycleMappingMetadata> </configuration> </plugin> </plugins></pluginManagement>
In addition, M2E provides a quick and easy way to solve the plugin execution not covered problem:
- Use <pluginManagement/> Surround Plugins
Execute
This option tells M2E that this behavior will be performed as part of the Eclipse workspace full creation or incremental creation.
<pluginManagement> <plugins> <plugin> <groupId>org.eclipse.m2e</groupId> <artif actid>lifecycle-mapping</artifactid> <version>1.0.0</version> <configuration> <li fecyclemappingmetadata> <pluginExecutions> <pluginExecution> <pluginexecutio Nfilter> <groupId>some-group-id</groupId> <artifactid>some-artifact-id</ Artifactid> <versionrange>[1.0.0,) </versionRange> <goals> &L t;goal>some-goal</goal> </goals> </pluginExecutionFilter> <act Ion><execute> <runOnIncremental>false</runOnIncremental> </execute></action> </pluginExecution> </pluginExecutions> </lifecycleMappingMetadata> </configuration> </plugin> </plugins></pluginManagement>
The quick fix is to create a ignore map, and then replace the <IGNORE/>,M2E 1.3 and later default settings with <execute/> Runonincremental to false.
Meta data Source (metadata sources) lookup order
1. the project pom.xml
2. the Parent project pom.xml , the grandfather Project , and pom.xml so on .
3. m2eclipse 1.2+ workspacepreferences
4. installed M2eclipse extensions ( no specific order )
5. the Maven plugin provides m2eclipse1.1+ lifecycle Mapping metadata
6. m2eclipse default lifecyclemapping metadata
M2eclipse use the first available mapping found.
Life cycle mapping metadata provided by the MAVEN plugin
Starting with M2E 1.1, MAVEN plug-in developers can provide lifecycle metadata sources in plug-ins.
This progress has reduced many of our needs in the Pom.xml for the plug-in configuration.
M2eclipse 1.2+ Workspace Preferences
Starting with M2eclipse 1.2, you can configure lifecycle mapping metadata in Workspace preferences, and the plug-in targets at the workspace level can be ignored directly using Quick-fix. It can then be viewed through preferences->maven->lifecyclemappings.
M2eclipse Plugin Execution not Covered