This is driving me insane. The Maven failsafe plugin will not run on my project. If I run mvn verify
only surefire runs. If I type mvn failsafe:verify
For me it worked only after I added the "default" includes.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.15</version>
<configuration>
<includes>
<include>**/IT*.java</include>
<include>**/*IT.java</include>
<include>**/*ITCase.java</include>
<include>**/IntegrationTest*.java</include>
</includes>
</configuration>
<executions>
<execution>
<id>failsafe-integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>failsafe-verify</id>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
Take a look at the failsafe docs for the test names failsafe
expects by default:
<includes>
<include>**/IT*.java</include>
<include>**/*IT.java</include>
<include>**/*ITCase.java</include>
</includes>
Are your tests named following one of these patterns? If not, try defining the <includes>
element in the plugin configuration. Or change your test name(s) to fit the default pattern.
Okay, now that we've verified the test class names - typically when I add executions to plugin config I do it something like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${version.maven.failsafe.plugin}</version>
<configuration>
</configuration>
<executions>
<execution>
<id>failsafe-integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>failsafe-verify</id>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
This explicitly binds the failsafe
plugin goals you want to run to the correct phases of the build lifecycle. I believe the surefire
plugin is bound to the test
lifecycle phase by default (for a jar, war, & ejb anyway), but nothing is bound to integration-test
or verify
.
Here I will share my 2 cents. I had same issue and solution above didn't solve my problem.
I had maven-failsafe-plugin encapsulated in pluginManagement tag. I noticed to move it out into plugins tag instead when I saw this doc in the 4.0.0 maven schema:
Default plugin information to be made available for reference by projects derived from this one. This plugin configuration will not be resolved or bound to the lifecycle unless referenced. Any local configuration for a given plugin will override the plugin's entire definition here.
Hopefully this additional info. solves more ppl's problem like myself.
If you are running 2.12.2 version of the failsafe plugin, this is normal. Switch to a previous version. It seem 2.13 is not available yet.
Jira link