Tuesday, September 23, 2014

Plugin execution not covered by lifecycle configuration

Eclipse is showing this error

Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-jar-plugin:2.4:jar (execution: make-jar, phase: compile)

It shows the error against the <execution> line in one of our POMs, an extract of which is below.

<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <build>
  ...
    <plugins>
    ...
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.4</version>
        <executions>
          <!-- Create shared ViewController JAR file which is used by MYPROJECT-API-V1 -->
          <execution>
            <id>make-jar</id>
            <phase>compile</phase>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
    ...

I only notice this error in Ecliipse Luna - it was not showing in Eclipse Kepler. Further, I can still build OK from the command line and even Eclipse still builds the project.

The fix was surprisingly easy. I select the quick fix: Discover new m2e connectors. Nothing came up, but when I clicked on FINISH, I found that Eclipse was indeed updating the m2e Connectors. I let it happen, re-started Eclipse, and the error disappeared.