From 790c9621e3f69baecf840a19074d54dc806aa528 Mon Sep 17 00:00:00 2001 From: Kenney Westerhof Date: Thu, 29 Sep 2005 21:58:01 +0000 Subject: [PATCH] Also skip compiling tests when -Dmaven.test.skip=true is provided. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@292561 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/plugin/TestCompilerMojo.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/TestCompilerMojo.java b/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/TestCompilerMojo.java index 74c26e67ac..f3a8646385 100644 --- a/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/TestCompilerMojo.java +++ b/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/TestCompilerMojo.java @@ -37,6 +37,14 @@ import java.util.Set; public class TestCompilerMojo extends AbstractCompilerMojo { + /** + * Set this to 'true' to bypass unit tests entirely. + * Its use is NOT RECOMMENDED, but quite convenient on occasion. + * + * @parameter expression="${maven.test.skip}" + */ + private boolean skip; + /** * The source directories containing the test-source to be compiled. * @@ -78,6 +86,20 @@ public class TestCompilerMojo */ private Set testExcludes = new HashSet(); + public void execute() + throws MojoExecutionException + { + if ( skip ) + { + getLog().info( "Not compiling test sources" ); + return; + } + else + { + super.execute(); + } + } + protected List getCompileSourceRoots() { return compileSourceRoots;