Is there a Maven plugin to list all test classes that are excluded by the Maven Surefire plugin?

Is there a Maven plugin that lists all test classes that are excluded by the Maven Surefire plugin when I run mvn test, but without having to run mvn test?

For instance, supposing there is a project with the following test classes:

org.foo.TestA org.foo.TestB org.foo.TestC org.foo.TestRandomA org.foo.TestRandomB 

and the maven surefire plugin is configure as:

<plugin>     <groupId>org.apache.maven.plugins</groupId>     <artifactId>maven-surefire-plugin</artifactId>     <configuration>         <includes>             <include>**/TestRandom*</include>         </includes>         <excludes>             <exclude>**/Test*</exclude>         </excludes>     </configuration> </plugin> 

How can I get the list of test classes that are excluded? I.e.,:

org.foo.TestA org.foo.TestB org.foo.TestC 

PS: Although this question does sound familiar to this other question, it is not. I just want the name of classes that are excluded by the Maven Surefire plugin, as opposite to the other question which wants all test classes. The answer to the other question was to run mvn test-compile and check the target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst file. However, that file lists all compiled test classes and not just the ones that are excluded by the Maven Surefire plugin.

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.