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;