You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sj...@apache.org on 2023/02/21 06:47:15 UTC

[maven-surefire] branch master updated: Sanitize failIfNoSpecifiedTests prefix in failsafe

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 208eae24b Sanitize failIfNoSpecifiedTests prefix in failsafe
208eae24b is described below

commit 208eae24bd8068d90078362f57fe2246ba1b2107
Author: Libor Rysavy <li...@users.noreply.github.com>
AuthorDate: Tue Oct 11 15:18:19 2022 +0200

    Sanitize failIfNoSpecifiedTests prefix in failsafe
    
    Surefire is using `surefire.failIfNoSpecifiedTests`,
    but failsafe used `it.failIfNoSpecifiedTests`.
    Error msg is then pointed to nonexistent property:
    `No tests matching pattern "..." were executed! (Set
    -Dfailsafe.failIfNoSpecifiedTests=false to ignore this error.)`
---
 .../maven/plugin/failsafe/IntegrationTestMojo.java | 23 ++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
index a67086704..b673b96b5 100644
--- a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
+++ b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
@@ -130,12 +130,24 @@ public class IntegrationTestMojo
     private boolean useFile;
 
     /**
-     * Set this to "true" to cause a failure if none of the tests specified in -Dtest=... are run. Defaults to
+     * Set this to "false" to prevent a failure if none of the tests specified in -Dit.test=... are run. Defaults to
      * "true".
      *
      * @since 2.12
+     * @deprecated Since 3.0.0-M8, use "failsafe.failIfNoSpecifiedTests" instead.
      */
+    @Deprecated
     @Parameter( property = "it.failIfNoSpecifiedTests", defaultValue = "true" )
+    private boolean failIfNoSpecifiedTestsDeprecated;
+
+    /**
+     * Set this to "false" to prevent a failure if none of the tests specified in -Dit.test=... are run. Defaults to
+     * "true".
+     * Replacing "it.failIfNoSpecifiedTests" to be consistent with surefire plugin.
+     *
+     * @since 3.0.0-M8
+     */
+    @Parameter( property = "failsafe.failIfNoSpecifiedTests", defaultValue = "true" )
     private boolean failIfNoSpecifiedTests;
 
     /**
@@ -899,9 +911,16 @@ public class IntegrationTestMojo
     }
 
     @Override
+    @SuppressWarnings( "deprecation" )
     public boolean getFailIfNoSpecifiedTests()
     {
-        return failIfNoSpecifiedTests;
+        if ( !failIfNoSpecifiedTestsDeprecated )
+        {
+            getConsoleLogger().warning( "Use " + getPluginName()
+                    + ".failIfNoSpecifiedTests property instead of obsolete it.failIfNoSpecifiedTests." );
+        }
+        // since both have default "true", assuming that any "false" is set by user on purpose
+        return failIfNoSpecifiedTests && failIfNoSpecifiedTestsDeprecated;
     }
 
     @Override