This seem to only happen in a small number of projects. I've been using Roo with STS for close to 2 years and I have never seen this specific problem before.
I've added 2 new source folders: "src/it/java" and "src/it/resources", besides that the project is a typical Spring Roo MVC project. In maven everything runs as expected and maven doesn't complain about anything, it's just STS that detect a mismatch. When I check the project config everything looks normal to me. Comparisons to very similar projects that do not exhibit this symptom doesn't reveal anything that sticks out. I'm wondering if source order in the pom affects.
Here's an extract of my setup of maven-builder-helper, Failsafe and Cargo:
Code:
<!-- All typical Roo dependencies and all other typical Roo pom parts here with Jetty being commented out. Jetty 7 is added as a profile instead.-->
<build>
<pluginManagement>
<!--All typical Roo made plugins without the executions part are within the "pluginManagement" element. The executions part go into the later "plugins" element.-->
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.2.1</version>
<!-- Config -->
<configuration>
<configuration>
<deployables>
<!-- The project's artifact is automatically deployed if no deployable
is defined. However, we define it here so that we can specify the context
(we don't want the version to be included in the context). -->
<deployable>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<type>war</type>
<properties>
<context>${project.artifactId}</context>
</properties>
</deployable>
</deployables>
<properties>
<cargo.servlet.port>${servlet.port}</cargo.servlet.port>
</properties>
</configuration>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<!--version 1.5 in previous section-->
<executions>
<execution>
<id>add-it-source</id>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/it/java</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-it-resource</id>
<goals>
<goal>add-test-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src/it/resources</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<!--Failsafe version 2.8 in pluginManagement section-->
<executions>
<execution>
<id>perform-it</id>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<systemProperties>
<property>
<name>servlet.port</name>
<value>${servlet.port}</value>
</property>
</systemProperties>
</configuration>
</execution>
<execution>
<id>verify-it</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<profiles>
<profile>
<id>jetty7x</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<container>
<containerId>jetty7x</containerId>
<artifactInstaller>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-distribution</artifactId>
<version>7.6.2.v20120308</version>
</artifactInstaller>
</container>
<!-- Tillagd -->
<webAppConfig>
<contextPath>/${project.name}</contextPath>
</webAppConfig>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>
</build>