Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 343030

Summary: Eclipse reporting Maven Project Build Lifecycle Mapping Problem errors when using the build-helper Maven plugin
Product: z_Archived Reporter: Mark A. Ziesemer <bugs>
Component: m2eAssignee: Project Inbox <m2e.core-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: igor, juha.heljoranta
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Minimal project version for use as test case none

Description Mark A. Ziesemer CLA 2011-04-16 02:41:02 EDT
Using m2e 0.13.0.201103151108, the latest available milestone build.

I have some Maven-enabled projects that make use of the add-source/add-resource/add-test-source/add-test-resource goals of the org.codehaus.mojo:build-helper-maven-plugin:1.5 plugin.

Granted, this is probably not the most ideal situation, but it is the only way that I found to build both Java 5 and Java 6 versions of a project.  (The Java 6 version includes the sources from the Java 5 version, and includes additional Java 6-specific classes.)  This worked without issue (including no errors or warnings) on previous versions of m2eclipse - 0.12.1, 0.12, and 0.10.

Now, I get the following errors, all of type "Maven Project Build Lifecycle Mapping Problem":
- Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:build-helper-maven-plugin:1.5:add-resource (execution: add-resource, phase: generate-sources)	pom.xml
- Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:build-helper-maven-plugin:1.5:add-source (execution: add-source, phase: generate-sources)	pom.xml
- Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:build-helper-maven-plugin:1.5:add-test-resource (execution: add-test-resource, phase: generate-sources)	pom.xml
- Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:build-helper-maven-plugin:1.5:add-test-source (execution: add-test-source, phase: generate-sources)	pom.xml

The "Quick Fix" on either of any errors gives me 2 choices: "Discover new m2e connectors" and "Ignore goal add-source in Eclipse build".  Neither works as expected:

"Discover new m2e connectors" suggested the "build-helper-maven-plugin".  I installed it, which included "m2e connector for build-helper-maven-plugin	0.13.0.201104061100 org.sonatype.m2e.buildhelper" into my Eclipse configuration.  After restarting, and running "Update Project Configuration" on the project, it didn't resolve the errors, but instead, added 3 additional errors:
- Project configurator "org.sonatype.m2e.buildhelper.buildhelperConfigurator" is not available. To enable full functionality, install the project configurator and run Maven->Update Project Configuration.	pom.xml
- Project configurator "org.sonatype.m2e.buildhelper.buildhelperConfigurator" is not available. To enable full functionality, install the project configurator and run Maven->Update Project Configuration.	pom.xml
- Unknown	pom.xml (Maven Build Problem)

"Ignore goal add-source in Eclipse build" makes the errors disappear.  However, it adds Eclipse-specific data into the pom.xml (pluginManagement/plugins/plugin, org.eclipse.m2e:lifecycle-mapping:1.0.0).  This is not desirable, as I'd strongly prefer to keep IDE-specific details out of pom.xml.  Couldn't these "ignore" rules be put into the Eclipse ".settings" folder instead?  (Maybe the existing org.eclipse.m2e.core.prefs file?)

My work-around for the moment is to simply select the errors from the Problems view, and choose the Delete option.  This works until I need to reconfigure the project for other reasons, or even close and re-open the project - at which point the errors reappear.  Even just restarting Eclipse causes the phantom "Unknown" Maven Build Problem to reappear.

The project sources I'm working with are available in the com.ziesemer.utils.jmx-2010.03.28.zip project on http://ziesemer.java.net.  However, I'm just now realizing that the available download is missing the parent pom.xml required for a proper Maven build, in Eclipse or otherwise.  I'll attach or link to a minimal version that can be used to reproduce these errors.
Comment 1 Mark A. Ziesemer CLA 2011-04-16 03:04:43 EDT
Created attachment 193411 [details]
Minimal project version for use as test case

Attaching a minimal version of a project for use as a test case.  To use:
1) Use the Eclipse import wizard, General/"Existing Projects into Workspace".
2) Select the archive file, then select only the parent project (MarkUtils-JMX-343030).
3) After import, right-click the project, Configure, "Convert to Maven Project".
4) Right-click the project, Import, Maven, Existing Maven Projects.  Select only the 2 child projects, then click Next.
5) On the "Setup Maven plugin connectors" page, click "Deselect all", then "Finish".
6) Observe a total of 7 errors in the "Problems" view (identical to those in comment #0).
Comment 2 Igor Fedorenko CLA 2011-04-19 15:51:04 EDT
There are two separate issues here.

First, build-helper-maven-plugin configurator available from m2e marketplace only supports add-source and add-test-source. It does not currently support add-resource and add-test-resource goals and I opened bug 343310 to track this enhancement request.

Second, attached sample project uses cross module source and resource folder references (i.e. "${basedir}/../MarkUtils-JMX-Java5/JavaSource"). This is not supported by m2e and there are no plans to provide such support neither in m2e core nor as part of m2e marketplace.
Comment 3 Mark A. Ziesemer CLA 2011-04-19 18:19:15 EDT
Igor, thanks for looking at this.  Just to clarify, while having specific m2e support for these features may be nice, I'm not even expecting it.  Really, I just want an option to at least be able to ignore the errors - and persistently.

I.E., I consider these errors to be "false positives".  They should at least be demoted to "warning" or "info" level, if they can't otherwise be configured away.

I don't see any actual issues with my projects.  The Maven builds complete as expected, and I don't see any limitations with Eclipse, as they were configured from pom.xml by m3.  Additionally, everything was working as expected with the older m2eclipse builds - even without any additional project configurators.
Comment 4 Igor Fedorenko CLA 2011-04-19 19:31:09 EDT
Suppressing these false positives using workspace or project preferences means that all developers who work on this project will have to replicate the same settings. Even you will have to replicate these settings if you decide to import this project to another workspace on the same computer. 

What are your objections against m2e-specific elements under build/pluginManagement? How are they worse then .settings/ files checked in source control system, for example?
Comment 5 Mark A. Ziesemer CLA 2011-04-19 19:48:02 EDT
Ideally, these "false positives" wouldn't even be generated.  (There may be something else going on here, but if so, I don't understand what it is.)

Conceptually, I feel that Maven and it's pom.xml should be IDE independent.  If 3 other Java IDEs implement similar functionality to what is being observed in this bug, then it adds that much more additional complexity into pom.xml - most of which won't be used by any of the other IDEs.

> Suppressing these false positives using workspace or project preferences means
that all developers who work on this project will have to replicate the same
settings. Even you will have to replicate these settings if you decide to
import this project to another workspace on the same computer.

Certainly agreed, this is not the intent.  Using the <pluginManagement/> in pom.xml would avoid this - as would something in .settings/ that indicates that any build-helper plugins should be ignored by m2e.

I guess my biggest issue is that under the previous m2eclipse versions, this project both worked in Eclipse and was buildable by Maven without error.  Now, it produces errors in Eclipse.
Comment 6 Igor Fedorenko CLA 2011-04-19 20:20:00 EDT
The old behaviour is essentially a bug. During project import and configuration update, m2e 0.12 and earlier ran some semi-random maven build phase and/or plugin and *assumed* the project would be fine. And many projects were fine. Unfortunately, for some projects this led to very hard to troubleshoot problems with classes/resources going missing intermittently, occasional endless builds and actions required to work on the project, like code generation, not being performed reliably inside workspace.

To solve these problems, m2e 0.13 requires explicit knowledge about all plugin executions bound to project build lifecycle. Currently, this knowledge can either come from installed m2e extensions (a.k.a "project configurator") or from project pom.xml file. Some additional information is available from https://docs.sonatype.org/display/M2ECLIPSE/Project+build+lifecycle+mapping but feel free to ask questions on m2e-user mailing list.
Comment 7 Mark A. Ziesemer CLA 2011-04-19 21:34:55 EDT
Sounds good.  Thanks for the information!
Comment 8 juha.heljoranta CLA 2011-06-24 13:38:56 EDT
Not sure if this is the correct bug but people are having a LOT of problems with this. For example:
http://stackoverflow.com/questions/6352208/how-to-solve-plugin-execution-not-covered-by-lifecycle-configuration-for-spring
and:
http://blog.objectteams.org/2011/06/between-the-times/

This also breaks Scala Eclipse integration for Maven projects:
      <plugin>
        <groupId>org.scala-tools</groupId>
        <artifactId>maven-scala-plugin</artifactId>
        <version>2.15.2</version>
        <executions>
          <execution> <!-- this line gives error: Plugin execution not covered by lifecycle configuration: org.scala-tools:maven-scala-plugin:2.15.2:compile (execution: default, phase: compile) -->
            <goals>
              <goal>compile</goal>
              <goal>testCompile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
Comment 9 Igor Fedorenko CLA 2011-06-27 01:32:05 EDT
For general description of "plugin execution not covered" error marker see http://wiki.eclipse.org/M2E_plugin_execution_not_covered

*** This bug has been marked as a duplicate of bug 343310 ***
Comment 10 Denis Roy CLA 2021-04-19 13:27:06 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/