apache / apache/maven-surefire
[SUREFIRE-2085] Surefire fails build on Modules that don't use surefire at all if -DexcludedGroups is given
- Dominant language
- Java
- Stars
- 461
- Forks
- 588
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 19
Description
**[Martin Höller](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=matinh)** opened **[SUREFIRE-2085](https://issues.apache.org/jira/browse/SUREFIRE-2085?redirect=false)** and commented
Assume a simple multi-module project with an API and an implementation module with JUnit as the testing framework. The API module just has interfaces and no unit tests at all, thus, no dependency to junit. It does not declare any configuration of the surefire-plugin in its POM. The implementation module uses junit 4.13.2 and has a few tests.
If I run `mvn test -DexcludedGroups=SlowTest` Surefire fails the build of the API module with the following error message:
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M6:test (default-test) on project sample-api: groups/excludedGroups require TestNG, JUnit48+ or JUnit 5 (a specific engine required on classpath) on project test classpath -> [Help 1]
Note, that tests in the implementation module might (or might not) use categories as explained [in the documentation](https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit.html#Using_JUnit_Categories).
IMHO Surefire should not fail the build in this situation as it would otherwise require one to either declare an unused dependency or configure surefire to be skipped, even if it's not used at all.
See also https://www.mail-archive.com/users@maven.apache.org/msg143919.html.
---
**Affects:** 3.0.0-M6
Contributor guide
Research direction
Start with the reported multi-module Maven example and run `mvn test -DexcludedGroups=SlowTest` against an API module without tests or JUnit, then inspect the Surefire test goal's handling of `groups` and `excludedGroups`. Done means the API module no longer fails solely because the property is present, while the implementation module's JUnit tests and category behavior remain supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100