2

When I am importing my maven project in my eclipse, I am getting this error:

Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:buildnumber-maven-plugin:1.0:create-timestamp (execution: generate-build-number, phase: generate-sources) pom.xml /DataClient line 6 Maven Project

Does anyone know how to fix this problem? I tried several other ways which was listed in SO questions but it didn't worked.

I am using eclipse kepler and I do have pluginManagement as well in my pom.xml file.

My pom.xml snippet where I am using plugins:

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>-javaagent:"${settings.localRepository}"/com/googlecode/jmockit/jmockit/1.7/jmockit-1.7.jar</argLine>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <configuration>
                    <instrumentation>
                        <excludes>
                            <exclude>**/test/**/*.class</exclude>
                        </excludes>
                    </instrumentation>
                    <formats>
                        <format>xml</format>
                        <format>html</format>
                    </formats>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.9.1</version>
                <configuration>
                    <author>false</author>
                    <keywords>true</keywords>
                    <show>public</show>
                    <links>
                        <link>http://docs.guava-libraries.googlecode.com/git-history/v16.0/javadoc/</link>
                        <link>http://netty.io/4.0/api/</link>
                    </links>
                    <doctitle>Data Client API (${project.version})</doctitle>
                    <windowtitle>Data Client API (${project.version})</windowtitle>
                    <groups>
                        <group>
                            <title>Core API</title>
                            <packages>com.host.grads.client:com.host.grads.client.resources</packages>
                        </group>
                        <group>
                            <title>Miscellaneous</title>
                            <packages>com.host.grads.client.utils</packages>
                        </group>
                    </groups>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </pluginManagement>
</build>
john
  • 11,311
  • 40
  • 131
  • 251
  • Can you copy your complete pom.xml ? It seems that the plugin `buildnumber-maven-plugin` involved in the issue is not present in the part you copied. For later, `buildnumber-maven-plugin` site : http://mojo.codehaus.org/buildnumber-maven-plugin/ – Fabien May 06 '15 at 08:18
  • Default the correct version of the buildnumber-maven-plugin cause it looks you are using an extreme old version of it. – khmarbaise May 06 '15 at 09:07
  • @Fabien These are the only plugins I have in my `` in my pom.xml file. Do I need to add anything to fix this issue? – john May 06 '15 at 16:05

1 Answers1

0

I found this on SO and I think that it is the answer to your problem : Plugin execution not covered by lifecycle configuration (JBossas 7 EAR archetype)

I copy the text initially written by Jan :

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 the "Plugin execution not covered by lifecycle configuration" error message.

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



If you need to implement this solution, you can have a look to this comment of the previously mentioned question : https://stackoverflow.com/a/26447353/4810148

Here is a copy of what coderplus answered. Of course you will have to replace the groupId and artifactId by the ones of the plugin that is concerned by your case.

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.

Community
  • 1
  • 1
Fabien
  • 859
  • 6
  • 15
  • I have seen this answer already but I am not sue what I need to do to fix this issue? – john May 07 '15 at 01:43