Skip to content

Commit 208eae2

Browse files
liryslawekjaranowski
authored andcommitted
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.)`
1 parent b8246dc commit 208eae2

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java

+21-2
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,24 @@ public class IntegrationTestMojo
130130
private boolean useFile;
131131

132132
/**
133-
* Set this to "true" to cause a failure if none of the tests specified in -Dtest=... are run. Defaults to
133+
* Set this to "false" to prevent a failure if none of the tests specified in -Dit.test=... are run. Defaults to
134134
* "true".
135135
*
136136
* @since 2.12
137+
* @deprecated Since 3.0.0-M8, use "failsafe.failIfNoSpecifiedTests" instead.
137138
*/
139+
@Deprecated
138140
@Parameter( property = "it.failIfNoSpecifiedTests", defaultValue = "true" )
141+
private boolean failIfNoSpecifiedTestsDeprecated;
142+
143+
/**
144+
* Set this to "false" to prevent a failure if none of the tests specified in -Dit.test=... are run. Defaults to
145+
* "true".
146+
* Replacing "it.failIfNoSpecifiedTests" to be consistent with surefire plugin.
147+
*
148+
* @since 3.0.0-M8
149+
*/
150+
@Parameter( property = "failsafe.failIfNoSpecifiedTests", defaultValue = "true" )
139151
private boolean failIfNoSpecifiedTests;
140152

141153
/**
@@ -899,9 +911,16 @@ public void setSystemPropertiesFile( File systemPropertiesFile )
899911
}
900912

901913
@Override
914+
@SuppressWarnings( "deprecation" )
902915
public boolean getFailIfNoSpecifiedTests()
903916
{
904-
return failIfNoSpecifiedTests;
917+
if ( !failIfNoSpecifiedTestsDeprecated )
918+
{
919+
getConsoleLogger().warning( "Use " + getPluginName()
920+
+ ".failIfNoSpecifiedTests property instead of obsolete it.failIfNoSpecifiedTests." );
921+
}
922+
// since both have default "true", assuming that any "false" is set by user on purpose
923+
return failIfNoSpecifiedTests && failIfNoSpecifiedTestsDeprecated;
905924
}
906925

907926
@Override

0 commit comments

Comments
 (0)