You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Martin Höller (Jira)" <ji...@apache.org> on 2022/05/17 12:10:00 UTC

[jira] [Updated] (SUREFIRE-2085) Surefire fails build on Modules that don't use surefire at all if -DexcludedGroups is given

     [ https://issues.apache.org/jira/browse/SUREFIRE-2085?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Höller updated SUREFIRE-2085:
------------------------------------
    Description: 
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:
{quote}[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]
{quote}
Note, that tests in the implementation module might (or might not) use categories as explained [in the documentation|#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].

  was:
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:
{quote}[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]
{quote}
Note, that tests in the implementation module might (or mighht 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|https://www.mail-archive.com/users@maven.apache.org/msg143919.html.]


> Surefire fails build on Modules that don't use surefire at all if -DexcludedGroups is given
> -------------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-2085
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-2085
>             Project: Maven Surefire
>          Issue Type: Bug
>    Affects Versions: 3.0.0-M6
>            Reporter: Martin Höller
>            Priority: Major
>
> 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:
> {quote}[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]
> {quote}
> Note, that tests in the implementation module might (or might not) use categories as explained [in the documentation|#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].



--
This message was sent by Atlassian Jira
(v8.20.7#820007)