I have Groovy project and I want to control by Surefire which tests to execute (sample repo).
Assuming I have test ExampleTest I can configure Surefire as follows:
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<configuration>
<includes>
<include>**/ExampleTest.*</include>
</includes>
</configuration>
</plugin>
I can also use <include>ExampleTest.*</include> or <include>ExampleTest</include> and it works.
Unfortunately I cannot configure it as <include>ExampleTest.groovy</include>, but it works for <include>ExampleTest.java</include>!
Why it works like that? Is it a bug?
Yes we can say it's a bug. You can't use .groovy in inclusion list. But it will work if you use .*, .java or .class.
I would recommend using the regex support in the <include> patterns as documented here.
For example, to include the ExampleTest.groovy file:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<configuration>
<includes>
<include>%regex[ExampleTest\.groovy]</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With