You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rm...@apache.org on 2020/04/25 15:31:45 UTC

[maven-surefire] 01/01: logging a warning if forkcount=0

This is an automated email from the ASF dual-hosted git repository.

rmannibucau pushed a commit to branch SUREFIRE-1781
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git

commit a71e86a8f49116140b24aa40eeacf2a828620b2d
Author: Romain Manni-Bucau <rm...@gmail.com>
AuthorDate: Sat Apr 25 17:31:27 2020 +0200

    logging a warning if forkcount=0
---
 .../org/apache/maven/plugin/surefire/AbstractSurefireMojo.java | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
index 112de82..8a0cd0a 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
@@ -1121,10 +1121,20 @@ public abstract class AbstractSurefireMojo
             warnIfWrongShutdownValue();
             warnIfNotApplicableSkipAfterFailureCount();
             warnIfIllegalTempDir();
+            warnIfForkCountIsZero();
         }
         return true;
     }
 
+    private void warnIfForkCountIsZero()
+    {
+        if ( "0".equals( getForkCount() ) )
+        {
+            getConsoleLogger().warning( "The parameter forkCount should likely not be 0, not forking a JVM for tests "
+                + "reduce test accuracy, ensure to have a <forkCount> >= 1." );
+        }
+    }
+
     private void executeAfterPreconditionsChecked( @Nonnull DefaultScanResult scanResult )
         throws MojoExecutionException, MojoFailureException
     {