zbig zbig - 2 months ago 17
Java Question

Maven (surefire) test plugin excludes not working

I have following configuration in my pom.xml

<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<excludes>
<exclude>**/DocumentChangeSubscriberTest.java</exclude>
</excludes>
</configuration>
</plugin>
(...)


DocumentChangeSubscriberTest
is an arquillian test that I want to run only in specified profile.
When I type
mvn install
all tests are run, even
DocumentChangeSubscriberTest
that I want to exclude.
How to exclude test from the default (anonymous) profile?

I tried
<includes><include>...
and it works fine - only included tests were run.

I saw maven surefire test plugin runs tests even if they are excluded: but this is not working for me. I also tried many versions of
maven-surefire-plugin
without result. Any ideas?

Answer

Ok, excluding tests works. It was as simple as mispelling my class name: DocumentChangeSubsriberTest.java instead of DocumentChangeSubscriberTest.java.

Sorry.