From 12aeb10cbc49a5257834c3be1d5516112658d345 Mon Sep 17 00:00:00 2001 From: Tobias Stadler Date: Mon, 18 Jan 2021 11:00:50 +0100 Subject: [PATCH] [SUREFIRE-1876] Added support for skipping unit test execution not affecting integration test execution --- .../maven/plugin/surefire/SurefirePlugin.java | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java b/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java index cd260c14bf..73bab41141 100644 --- a/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java +++ b/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java @@ -25,6 +25,7 @@ import java.util.List; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugin.surefire.booterclient.ChecksumCalculator; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -53,6 +54,15 @@ public class SurefirePlugin @Parameter( defaultValue = "${project.build.outputDirectory}" ) private File classesDirectory; + /** + * Set this to "true" to skip running unit tests, but still compile them. Its use is NOT RECOMMENDED, but + * quite convenient on occasion. + * + * @since 3.0.0-M6 + */ + @Parameter( property = "skipUTs" ) + private boolean skipUTs; + /** * Set this to "true" to ignore a failure during testing. Its use is NOT RECOMMENDED, but quite convenient on * occasion. @@ -472,7 +482,7 @@ protected void handleSummary( RunResult summary, Exception firstForkException ) @Override protected boolean isSkipExecution() { - return isSkip() || isSkipTests() || isSkipExec(); + return isSkip() || isSkipTests() || isSkipUTs() || isSkipExec(); } @Override @@ -520,6 +530,16 @@ public void setSkipTests( boolean skipTests ) this.skipTests = skipTests; } + public boolean isSkipUTs() + { + return skipUTs; + } + + public void setSkipUTs( boolean skipUTs ) + { + this.skipUTs = skipUTs; + } + @Override public boolean isSkipExec() { @@ -880,4 +900,10 @@ protected final ForkNodeFactory getForkNode() { return forkNode; } + + @Override + protected void addPluginSpecificChecksumItems( ChecksumCalculator checksum ) + { + checksum.add( skipUTs ); + } }