maven-surefire-plugin include/exclude precedence

后端 未结 2 638
眼角桃花
眼角桃花 2021-01-01 12:42

When using the maven-surefire-plugin and both includes and excludes, which order are they processed in? Furthermore, if you have 3 sets of tests, the first being the base s

相关标签:
2条回答
  • 2021-01-01 13:30

    I couldn't find official documentation about surefire plugin, but indeed the exclude-override-include is a common approach and is also applied by Maven in other similar contexts, like for resources.

    The only official an related info (I found) comes from the official Maven POM Reference documentation, here:

    includes: A set of files patterns which specify the files to include as resources under that specified directory, using * as a wildcard.

    excludes: The same structure as includes, but specifies which files to ignore. In conflicts between include and exclude, exclude wins.

    NOTE: I added the final bold formatting on the interesting statement.

    So more than probably the same approach is used across official maven plugins (in general, all the plugins having the org.apache.maven.plugins groupId and maven- prefix as artifactId).

    0 讨论(0)
  • 2021-01-01 13:34

    Have you tried using JUnit categories?

    http://www.agile-engineering.net/2012/04/unit-and-integration-tests-with-maven.html

    Using that approach, you could give tests a number of different categories, and exclude/include them using that, rather than the class name. This would be a more extensible approach.

    0 讨论(0)
提交回复
热议问题