-1

I have a maven project which work with maven command (for example mvn install) but when I try to import it into eclipse I got error /complaining about pom.xml The error message from eclipse is :

Plugin execution not covered by lifecycle configuration: com.google.code.maven-replacer-plugin:replacer:1.5.3:replace (execution: default, phase: process-sources)

Below is the snippet of pom.xml which eclipse complains

        <plugin>
            <groupId>com.google.code.maven-replacer-plugin</groupId>
            <artifactId>replacer</artifactId>
            <version>1.5.3</version>
            <executions>
                <execution>
                    <phase>process-sources</phase>
                    <goals>
                        <goal>replace</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <file>src/main/java/com/xyz/Version.java.template</file>
                <outputFile>src/main/java/com/xyz/Version.java</outputFile>
                <replacements>
                    <replacement>
                        <token>@buildtime@</token>
                        <value>${maven.build.timestamp}</value>
                    </replacement>
                    <replacement>
                        <token>@pomversion@</token>
                        <value>${project.version}</value>
                    </replacement>
                </replacements>
            </configuration>
        </plugin>

Any hints will be more than welcome!

Nicholas K
  • 15,148
  • 7
  • 31
  • 57
stewchicken
  • 463
  • 1
  • 8
  • 20
  • Possible duplicate of [Plugin execution not covered by lifecycle configuration error in eclipse with pluginManagement in parent pom](https://stackoverflow.com/questions/19432073/plugin-execution-not-covered-by-lifecycle-configuration-error-in-eclipse-with-pl) – SiKing Aug 14 '18 at 23:14

2 Answers2

0

Since you have shared incomplete pom , I am assuming , you do not have pluginManagement tag in your pom.xml.

Put your plugin blocks inside pluginManagement tag. E.g.:

<build>
    <pluginManagement>
        <plugins>
            <plugin> ... </plugin>
            <plugin> ... </plugin>                     
        </plugins>
    </pluginManagement>
</build>
tryingToLearn
  • 10,691
  • 12
  • 80
  • 114
0

The cause of this error is that Eclipse is unable to match some of the Maven build phases to its own build model, because Maven's is more sophisticated than Eclipse's (In this case, it is the process-sources phase, which some plugin is bound to).

But Eclipse offers a way to ignore this plugin, so that this error won't show up again. Open the POM and set the Overview tab. You should see the error message upside. Pass the mouse over and click on it. A popup must appear showing three options. You may chose between the last two:

  • Mark goal replace as ignored in pom.xml: If you click on this one, Eclipse will modify the POM file to add some declarations that will make Eclipse ignore this plugin.
  • Mark goal replace as ignored in Eclipse preferences: Though this one, Eclipse will modify its own configuration (Window > Preferences > Maven > Lifecycle Mappings) to ignore this plugin on every POM, from now on.
Little Santi
  • 8,563
  • 2
  • 18
  • 46