Maven/Eclipse workspace integration approach implemented in m2eclipse 0.12 and earlier was to execute some parts of Maven build lifecycle inside and then configure eclipse workspace project based on after-execution state collected in MavenProject instance. This was controlled by no less than different sets of maven goals -- goals to execute during project import, project configuration update and workspace full and incremental builds. Some of these were configured at workspace level, some in project/.settings. On top of that, there was project-level setting to "skip" maven-compiler-plugin execution.

+

m2eclipse 0.12 and earlier executed some parts of Maven build lifecycle inside Eclipse and then configured the Eclipse project based on after-execution state collected in MavenProject. This was controlled by many different sets of maven goals -- goals when projects were imported, project configuration changes and workspace full and incremental builds. Some of these goals were configured at workspace level, some in project/.settings. On top of that, there was project-level setting to "skip" maven-compiler-plugin execution.

−

Unfortunately, this did not work well or did not work at all for many projects. Probably even worse, it did not *always* work for many projects, so we had to go through series of refresh/update dependencies/update configuration/rebuild voodoo (or "m2eclipse dance" as some called it) to get projects in a good state. For example [https://issues.sonatype.org/browse/MNGECLIPSE-823 MNGECLIPSE-823]&nbsp;was the most voted issue in m2e jira and it was a direct manifestation of this "flakiness".

+

Unfortunately, this did not work well or not at all for many projects. Probably even worse, it did not *always* work for many projects, so we had to go through series of refresh/update dependencies/update configuration/rebuild voodoo (or "m2eclipse dance" as some called it) to get projects in a good state. For example [https://issues.sonatype.org/browse/MNGECLIPSE-823 MNGECLIPSE-823]&nbsp;was the most voted issue in m2e jira and it was a direct manifestation of this "flakiness".

−

Most if not all such problems were traced back to one of two root causes. Out-of-workspace resource changes made by maven plugin triggered unexpected workspace builds. This was very indeterministic. In some cases projects appeared to work fine. In some cases, generated/filtered resources would go missing. And in some cases workspace build would go on forever. Various JVM and OS resources leaks by Maven plugins was another common cause of problems.

+

Most, if not all, such problems were traced back to one of two root causes. 1. Out-of-workspace resource changes made by Maven plugin triggered unexpected workspace builds. This was very indeterministic. In some cases projects appeared to work fine. In some cases, generated/filtered resources would go missing. And in some cases workspace build would go on forever. 2. Various JVM and OS resources leaks by Maven plugins was another common cause of problems.

To solve these 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 a 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.

+

Project build lifecycle mapping can be configured in a project's pom.xml, contributed by Eclipse plugins, or defaulted to the 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:

<pre>Plugin execution not covered by lifecycle configuration:

org.apache.maven.plugins:maven-antrun-plugin:1.3:run

org.apache.maven.plugins:maven-antrun-plugin:1.3:run

(execution: generate-sources-input, phase: generate-sources)

(execution: generate-sources-input, phase: generate-sources)

</pre>

</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'''.

+

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

Background

m2eclipse 0.12 and earlier executed some parts of Maven build lifecycle inside Eclipse and then configured the Eclipse project based on after-execution state collected in MavenProject. This was controlled by many different sets of maven goals -- goals when projects were imported, project configuration changes and workspace full and incremental builds. Some of these goals were configured at workspace level, some in project/.settings. On top of that, there was project-level setting to "skip" maven-compiler-plugin execution.

Unfortunately, this did not work well or not at all for many projects. Probably even worse, it did not *always* work for many projects, so we had to go through series of refresh/update dependencies/update configuration/rebuild voodoo (or "m2eclipse dance" as some called it) to get projects in a good state. For example MNGECLIPSE-823 was the most voted issue in m2e jira and it was a direct manifestation of this "flakiness".

Most, if not all, such problems were traced back to one of two root causes. 1. Out-of-workspace resource changes made by Maven plugin triggered unexpected workspace builds. This was very indeterministic. In some cases projects appeared to work fine. In some cases, generated/filtered resources would go missing. And in some cases workspace build would go on forever. 2. Various JVM and OS resources leaks by Maven plugins was another common cause of problems.

To solve these 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 a 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 can be configured in a project's pom.xml, contributed by Eclipse plugins, or defaulted to the 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.

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.

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

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