Plugin execution not covered by lifecycle configuration (JBossas 7 EAR archetype)

234,827

Solution 1

This is a "feature" of the M2E plugin that had been introduced a while ago. It's not directly related to the JBoss EAR plugin but also happens with most other Maven plugins.

If you have a plugin execution defined in your pom (like the execution of maven-ear-plugin:generate-application-xml), you also need to add additional config information for M2E that tells M2E what to do when the build is run in Eclipse, e.g. should the plugin execution be ignored or executed by M2E, should it be also done for incremental builds, ... If that information is missing, M2E complains about it by showing this error message:

"Plugin execution not covered by lifecycle configuration"

See here for a more detailed explanation and some sample config that needs to be added to the pom to make that error go away:

https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html

Solution 2

anyway it's too late but my solution was simple right-click on error-message in Eclipse and choosing Quick Fix >> Ignore for every pom with such errors

Solution 3

Eclipse has got the concept of incremental builds.This is incredibly useful as it saves a lot of time.

How is this Useful

Say you just changed a single .java file. The incremental builders will be able to compile the code without having to recompile everything(which will take more time).

Now what's the problem with Maven Plugins

Most of the maven plugins aren't designed for incremental builds and hence it creates trouble for m2e. m2e doesn't know if the plugin goal is something which is crucial or if it is irrelevant. If it just executes every plugin when a single file changes, it's gonna take lots of time.

This is the reason why m2e relies on metadata information to figure out how the execution should be handled. m2e has come up with different options to provide this metadata information and the order of preference is as below(highest to lowest)

  1. pom.xml file of the project
  2. parent, grand-parent and so on pom.xml files
  3. [m2e 1.2+] workspace preferences
  4. installed m2e extensions
  5. [m2e 1.1+] lifecycle mapping metadata provided by maven plugin
  6. default lifecycle mapping metadata shipped with m2e

1,2 refers to specifying pluginManagement section in the tag of your pom file or any of it's parents. M2E reads this configuration to configure the project.Below snippet instructs m2e to ignore the jslint and compress goals of the yuicompressor-maven-plugin

<pluginManagement>
        <plugins>
            <!--This plugin's configuration is used to store Eclipse m2e settings 
                only. It has no influence on the Maven build itself. -->
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>net.alchim31.maven</groupId>
                                    <artifactId>yuicompressor-maven-plugin</artifactId>
                                    <versionRange>[1.0,)</versionRange>
                                    <goals>
                                        <goal>compress</goal>
                                        <goal>jslint</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore />
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>

3) In case you don't prefer polluting your pom file with this metadata, you can store this in an external XML file(option 3). Below is a sample mapping file which instructs m2e to ignore the jslint and compress goals of the yuicompressor-maven-plugin

<?xml version="1.0" encoding="UTF-8"?>
<lifecycleMappingMetadata>
    <pluginExecutions>
        <pluginExecution>
            <pluginExecutionFilter>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>yuicompressor-maven-plugin</artifactId>
                <versionRange>[1.0,)</versionRange>
                <goals>
                    <goal>compress</goal>
                    <goal>jslint</goal>
                </goals>
            </pluginExecutionFilter>
            <action>
                <ignore/>
            </action>
        </pluginExecution>
    </pluginExecutions>
</lifecycleMappingMetadata>

4) In case you don't like any of these 3 options, you can use an m2e connector(extension) for the maven plugin.The connector will in turn provide the metadata to m2e. You can see an example of the metadata information within a connector at this link . You might have noticed that the metadata refers to a configurator. This simply means that m2e will delegate the responsibility to that particular java class supplied by the extension author.The configurator can configure the project(like say add additional source folders etc) and decide whether to execute the actual maven plugin during an incremental build(if not properly managed within the configurator, it can lead to endless project builds)

Refer these links for an example of the configuratior(link1,link2). So in case the plugin is something which can be managed via an external connector then you can install it. m2e maintains a list of such connectors contributed by other developers.This is known as the discovery catalog. m2e will prompt you to install a connector if you don't already have any lifecycle mapping metadata for the execution through any of the options(1-6) and the discovery catalog has got some extension which can manage the execution.

The below image shows how m2e prompts you to install the connector for the build-helper-maven-plugin. install connector suggested from the discovery catalog.

5)m2e encourages the plugin authors to support incremental build and supply lifecycle mapping within the maven-plugin itself.This would mean that users won't have to use any additional lifecycle mappings or connectors.Some plugin authors have already implemented this

6) By default m2e holds the lifecycle mapping metadata for most of the commonly used plugins like the maven-compiler-plugin and many others.

Now back to the question :You can probably just provide an ignore life cycle mapping in 1, 2 or 3 for that specific goal which is creating trouble for you.

Solution 4

A good workaround to remind you that m2e could be better configured, without the project inheriting a false positive error marker, is to just downgrade those errors to warnings:

Window -> Preferences -> Maven -> Errors/Warnings -> Plugin execution not covered by lifecycle configuration = Warning

Solution 5

I tried to execute specific plugging right after clean up i.e. post-clean (default is clean phase). This worked for me with eclipse indigo. Just added post-clean resolved the problem for me.

<executions>
  <execution>
    <configuration>
    </configuration>
   <phase>post-clean</phase>
    <goals>
      <goal>update-widgetset</goal>
    </goals>
  </execution>
</executions> 
Share:
234,827
OCB
Author by

OCB

The best way to predict the future is to create it https://business.sendperks.com

Updated on September 01, 2020

Comments

  • OCB
    OCB almost 4 years

    I am using Eclipse 3.7 Indigo with Maven M2E Plugin 1.0.100.

    Using the JBoss 7.x JavaEE 6 EAR archetype, the pom for EAR is giving me this error:

    Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-ear-plugin:2.6:generate-application-xml (execution: default-generate-application-xml, phase: generate-resources)

    <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-ear-plugin</artifactId>
       <version>2.6</version>
       <configuration>
          <!-- Tell Maven we are using Java EE 6 -->
          <version>6</version>
          <!-- Use Java EE ear libraries as needed. Java EE ear libraries 
                      are in easy way to package any libraries needed in the ear, and automatically 
                      have any modules (EJB-JARs and WARs) use them -->
          <defaultLibBundleDir>lib</defaultLibBundleDir>
          <modules></modules>
       </configuration>
    <plugin>
    
  • Cris
    Cris almost 12 years
    But that implies modifying the pom ... it does not affect the build ?
  • rapt
    rapt about 11 years
    @Jan I don't understand the concept. M2E should be transparent to the user. Do what that the command line Maven does, but from within eclipse. There should not be in the pom config data to tell M2E what to do. If it does, then it's a bad design. BTW, these errors are sometimes gone in newer versions of Eclipse and M2E.
  • William
    William about 11 years
    I agree with rapt. My POM has no dependency on m2e and I would want to add one now just because I happen to be using Eclipse as my IDE. That is an impost to others working on the same project that may well be using another IDE such as IntelliJ. If m2e needs these hints then it should be part of the m2e config within Eclipse.
  • Sander Verhagen
    Sander Verhagen about 11 years
    Some goals don't make sense while in Eclipse. E.g., I have projects where ZIP files are unpacked to the target folder. You'd not want that to be re-done "incrementally" upon saving each source file. Or maybe you do want that. Really, m2e has no idea about your specific build. You can store what m2e should do in Eclipse, POM, or possibly install a m2e connector that adds more knowledge to m2e to handle the build step. These are the options that you should be seeing. I understand you don't want to make your POM m2e-aware, but it's a nice place to centrally configure this for all your devs.
  • Kissaki
    Kissaki over 10 years
    Could you explain why that works? “just added” and “resolved for me” does not really increase my trust in it not having unwanted hidden behaviours.
  • Ricardo Gladwell
    Ricardo Gladwell about 10 years
    Downvoted for smarm: m2e team didn't have any other option IMHO so i don't know why you put square quotes around the word feature.
  • reinierpost
    reinierpost about 10 years
    Sure enough, I have a phase and a goal for the execution in the pom.xml that was given to me, and I still get the error.
  • reinierpost
    reinierpost about 10 years
    It's not too late. I just fixed the problem this way!
  • reinierpost
    reinierpost about 10 years
    The problem is that the linked documentation for this, like most documentation on Maven or Eclipse. is abcacadabra. No matter how hard they try to explain it clearly, the explanation rests on too many concepts that I as a relatively new Maven user do not understand and don't know how to look up - everything I find has the same problem: too many unexplained concepts. The technology is too complex or the documentation is too poorly organized. In any case, the learning curve is high. The answers here add a great deal of clarity.
  • Charith De Silva
    Charith De Silva about 10 years
    Gents - my apologies. I'm no maven expert, wanted to help out some1 seeking for a quick solution. I should hv given more insight though. I think the trick here is the inclusion of the execution phase. Since mojo can define with phases of executing, i tried to execute specific plugging right after clean up i.e. post-clean (default is clean phase). This worked for me with eclipse indigo. Probably specific plugin may have used some dependencies from the main pom ? IIRC this was Vaadin based plugin.
  • Dawood ibn Kareem
    Dawood ibn Kareem almost 10 years
    @RicardoGladwell You have misunderstood the purpose of downvotes. The arrow says "this answer is not useful" - and that is untrue of this answer. So even though you dislike the tone with which this answer is written, the downvote was uncalled for.
  • Ricardo Gladwell
    Ricardo Gladwell almost 10 years
    @DavidWallace i downvoted the answer because it contains incomplete or incorrect information. Hypocrisy abounds as my got downvoted. Wonder by whom?
  • Dawood ibn Kareem
    Dawood ibn Kareem almost 10 years
    I never downvoted your answer. How dare you call me a hypocrite! @RicardoGladwell
  • dleerob
    dleerob over 9 years
    Me too. All this research and trying to understand what the problem was gave me a headache, so I ignored it :) Thanks.
  • Michael Osofsky
    Michael Osofsky over 9 years
    This worked for me. I suspect it automatically generates what's described by @Jan's answer that points to eclipse.org/m2e/documentation/m2e-execution-not-covered.html because the only change I saw after I accepted the quick fix was a change to my pom.xml.
  • Michael Osofsky
    Michael Osofsky over 9 years
    I tried again on another machine and the problem disappeared when I upgraded from JBehave 3.9.4 to 3.9.5 since it was JBehave plugin, in my case, that was creating the error (I had generated the plugin configuration from a JBehave Maven archetype (jbehave.org/reference/stable/archetypes.html))
  • William Kinaan
    William Kinaan almost 9 years
    At least now I know the reason of this so-so-so-so-bad error, but I will need 10 years to find the solution