Search code examples
eclipsescalamavenmaven-pluginm2eclipse

maven-scala-plugin giving pom file error


I'm testing java code using scala and maven. The maven-scala-plugin is returning a pom file error in Eclipse. Here is my pom snippet :

        <plugin>
            <groupId>org.scala-tools</groupId>
            <artifactId>maven-scala-plugin</artifactId>
            <version>2.15.2</version>
            <executions>
                <execution>
                    <id>scala-test-compile</id>
                    <phase>test-compile</phase>
                    <goals>
                        <goal>testCompile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

This is the error :

Plugin execution not covered by lifecycle configuration: org.scala-tools:maven-scala-plugin:2.15.2:testCompile 
 (execution: scala-test-compile, phase: test-compile)

Have I configured the pom correctly ?

The scala tests are running correctly, in that they are all passing. Perhaps this is a Maven bug ?

When I view maven properties for the project the lifecycle mappings are not available : enter image description here


Solution

  • No, this is not a Maven bug. This page describes why the message is shown and how to deal with it.

    After pressing Ctrl+1 over the problem Eclipse should suggest two quick fixes:

    1. Discover new m2e connectors. Try this first, if it finds a connector restart Eclipse and rebuild the project, the problem should go away.

    2. Permanently mark goal as ignored. It will add some code in pom.xml which means the goal won't be run on builds within Eclipse, only from command line. You can also replace <ignore> in the added part with <execute> to run the goal in Eclipse as well.