M2E and having maven generated source folders as eclipse source folders

Solution 1:

You need to attach the source directory with the build-helper-plugin.

Like so:

 <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>add-source</goal>
            </goals>
            <configuration>
                <sources>
                    <source>${project.build.directory}/generated-sources/java/</source>
                </sources>
            </configuration>
        </execution>
    </executions>
 </plugin>

You will also need to:

  • Install the "Apt M2E Connector" from the Eclipse Marketplace. To do so click the error in the Overview tab of your pom.xml and select "Discover".
  • Ensure there are no plugin execution filters for the build-helper-maven-plugin (see https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html)

Solution 2:

Right-click the Error message:

Project configuration is not up-to-date with pom.xml Run project configuration update

in the Problems View and select Quick Fix and click Finish to select the default Update project configuration. This fixes it.