My directory structure is like so:
src/integrationTest/java
src/test/java
src/main/java
I am trying to get failsafe to pick-up the integration tests, but failing to do so in the way I would like.
I have tried this:
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.17</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<testSourceDirectory>src/integrationTest/java</testSourceDirectory>
<testClassesDirectory>${project.build.directory}/it-classes</testClassesDirectory>
</configuration>
</plugin>
and this:
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.17</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<includes>
<include>src/integrationTest/**/*.java</include>
</includes>
</configuration>
</plugin>
to no avail; failsafe does not find tests to run.
I have been able to use the build-helper-maven plugin to add a test-source directory and then failsafe runs the tests.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9.1</version>
<executions>
<execution>
<id>add-integration-test-source-as-test-sources</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/integrationTest/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
However, the problem now is that surefire now also runs the tests as unit-tests. Also it seems unnecessary to use another plugin when failsafe should be able to find the tests; I would prefer to not to need to use build-helper maven plugin and configure surefire to exclude that path.
What am I doing wrong?