You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2008/03/22 23:52:56 UTC

svn commit: r640113 - in /maven/plugins/trunk/maven-ant-plugin/src: it/skip-missing-junit-it/ it/skip-missing-junit-it/src/ it/skip-missing-junit-it/src/test/ it/skip-missing-junit-it/src/test/java/ it/skip-missing-junit-it/src/test/java/it/ it/skip-te...

Author: bentmann
Date: Sat Mar 22 15:52:46 2008
New Revision: 640113

URL: http://svn.apache.org/viewvc?rev=640113&view=rev
Log:
[MANT-22] Make it possible to run the package target without tests

Added:
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/   (with props)
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/custom-build.xml   (with props)
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/goals.txt   (with props)
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/pom.xml   (with props)
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/src/
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/src/test/
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/src/test/java/
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/src/test/java/it/
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/src/test/java/it/SkippedTest.java   (with props)
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/verify.bsh   (with props)
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/   (with props)
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/goals.txt   (with props)
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/pom.xml   (with props)
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/src/
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/src/test/
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/src/test/java/
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/src/test/java/it/
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/src/test/java/it/BadTest.java   (with props)
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/verify.bsh   (with props)
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/   (with props)
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/goals.txt   (with props)
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/pom.xml   (with props)
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/src/
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/src/test/
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/src/test/java/
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/src/test/java/it/
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/src/test/java/it/SkippedTest.java   (with props)
    maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/verify.bsh   (with props)
    maven/plugins/trunk/maven-ant-plugin/src/site/apt/examples/skip-tests.apt   (with props)
Modified:
    maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java
    maven/plugins/trunk/maven-ant-plugin/src/site/apt/examples/fail-missing-junit.apt
    maven/plugins/trunk/maven-ant-plugin/src/site/apt/index.apt
    maven/plugins/trunk/maven-ant-plugin/src/site/site.xml

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Mar 22 15:52:46 2008
@@ -0,0 +1,5 @@
+target
+build.xml
+maven-build.properties
+maven-build.xml
+build.log

Added: maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/custom-build.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/custom-build.xml?rev=640113&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/custom-build.xml (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/custom-build.xml Sat Mar 22 15:52:46 2008
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="skip-missing-junit-it" default="package" basedir=".">
+
+  <import file="maven-build.xml"/>
+
+  <target name="junit-missing" 
+          depends="test-junit-status" 
+          if="junit.missing">
+    <echo level="error">Skipping tests should also work if JUnit is not present at all.</echo>
+    <fail>JUnit not found on class path, cannot run unit tests.</fail>
+  </target>
+
+</project>

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/custom-build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/custom-build.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/goals.txt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/goals.txt?rev=640113&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/goals.txt (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/goals.txt Sat Mar 22 15:52:46 2008
@@ -0,0 +1,3 @@
+clean
+ant:ant
+antrun:run

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/goals.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/goals.txt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/pom.xml?rev=640113&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/pom.xml (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/pom.xml Sat Mar 22 15:52:46 2008
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.plugins.maven-ant-plugin.it</groupId>
+  <artifactId>skip-missing-junit-it</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <build>
+    <finalName>${project.artifactId}</finalName>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-ant-plugin</artifactId>
+        <version>@pom.version@</version>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-clean-plugin</artifactId>
+        <version>2.2</version>
+        <configuration>
+          <filesets>
+            <fileset>
+              <directory>${basedir}</directory>
+              <includes>
+                <include>build.xml</include>
+                <include>maven-build.*</include>
+              </includes>
+            </fileset>
+          </filesets>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <version>1.1</version>
+        <configuration>
+          <tasks>
+          	<property name="maven.test.skip" value="true" />
+            <ant dir="${basedir}" antfile="${basedir}/custom-build.xml" target="test" />
+          </tasks>
+        </configuration>
+        <dependencies>
+          <dependency>
+            <groupId>ant</groupId>
+            <artifactId>ant-junit</artifactId>
+            <version>1.6.5</version>
+          </dependency>
+          <!-- exclude junit -->
+        </dependencies>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.2</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <properties>
+    <build.compiler>extJavac</build.compiler>
+  </properties>
+
+</project>

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/src/test/java/it/SkippedTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/src/test/java/it/SkippedTest.java?rev=640113&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/src/test/java/it/SkippedTest.java (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/src/test/java/it/SkippedTest.java Sat Mar 22 15:52:46 2008
@@ -0,0 +1,37 @@
+package it;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Id$
+ */
+public class SkippedTest
+    extends TestCase
+{
+
+    public void testFail()
+        throws Exception
+    {
+        fail( "This test should have been skipped." );
+    }
+
+}

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/src/test/java/it/SkippedTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/src/test/java/it/SkippedTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/verify.bsh?rev=640113&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/verify.bsh (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/verify.bsh Sat Mar 22 15:52:46 2008
@@ -0,0 +1,14 @@
+import java.io.*;
+import java.util.*;
+
+try
+{
+    // nothing to verify, tests would have failed to build if not skipped
+}
+catch( Throwable t )
+{
+    t.printStackTrace();
+    return false;
+}
+
+return true;

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/verify.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-missing-junit-it/verify.bsh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Mar 22 15:52:46 2008
@@ -0,0 +1,5 @@
+target
+build.xml
+maven-build.properties
+maven-build.xml
+build.log

Added: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/goals.txt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/goals.txt?rev=640113&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/goals.txt (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/goals.txt Sat Mar 22 15:52:46 2008
@@ -0,0 +1,3 @@
+clean
+ant:ant
+antrun:run

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/goals.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/goals.txt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/pom.xml?rev=640113&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/pom.xml (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/pom.xml Sat Mar 22 15:52:46 2008
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.plugins.maven-ant-plugin.it</groupId>
+  <artifactId>skip-test-compilation-it</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <build>
+    <finalName>${project.artifactId}</finalName>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-ant-plugin</artifactId>
+        <version>@pom.version@</version>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-clean-plugin</artifactId>
+        <version>2.2</version>
+        <configuration>
+          <filesets>
+            <fileset>
+              <directory>${basedir}</directory>
+              <includes>
+                <include>build.xml</include>
+                <include>maven-build.*</include>
+              </includes>
+            </fileset>
+          </filesets>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <version>1.1</version>
+        <configuration>
+          <tasks>
+          	<property name="maven.test.skip" value="true" />
+            <ant dir="${basedir}" antfile="${basedir}/build.xml" target="compile-tests" />
+          </tasks>
+        </configuration>
+        <dependencies>
+          <dependency>
+            <groupId>ant</groupId>
+            <artifactId>ant-junit</artifactId>
+            <version>1.6.5</version>
+          </dependency>
+          <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>3.8.2</version>
+          </dependency>
+        </dependencies>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.2</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <properties>
+    <build.compiler>extJavac</build.compiler>
+  </properties>
+
+</project>

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/src/test/java/it/BadTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/src/test/java/it/BadTest.java?rev=640113&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/src/test/java/it/BadTest.java (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/src/test/java/it/BadTest.java Sat Mar 22 15:52:46 2008
@@ -0,0 +1,31 @@
+package it;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Id$
+ */
+public class BadTest
+    extends TestCase
+{
+
+// missing closing brace to cause compile error if test not excluded

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/src/test/java/it/BadTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/src/test/java/it/BadTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/verify.bsh?rev=640113&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/verify.bsh (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/verify.bsh Sat Mar 22 15:52:46 2008
@@ -0,0 +1,20 @@
+import java.io.*;
+import java.util.*;
+
+try
+{
+    File classesDir = new File( basedir, "target/test-classes" );
+
+    if ( classesDir.exists() )
+    {
+        System.err.println( "Creation of output directory for test classes not skipped: " + classesDir );
+        return false;
+    }
+}
+catch( Throwable t )
+{
+    t.printStackTrace();
+    return false;
+}
+
+return true;

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/verify.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-compilation-it/verify.bsh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Mar 22 15:52:46 2008
@@ -0,0 +1,5 @@
+target
+build.xml
+maven-build.properties
+maven-build.xml
+build.log

Added: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/goals.txt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/goals.txt?rev=640113&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/goals.txt (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/goals.txt Sat Mar 22 15:52:46 2008
@@ -0,0 +1,3 @@
+clean
+ant:ant
+antrun:run

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/goals.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/goals.txt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/pom.xml?rev=640113&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/pom.xml (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/pom.xml Sat Mar 22 15:52:46 2008
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.plugins.maven-ant-plugin.it</groupId>
+  <artifactId>skip-test-execution-it</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <build>
+    <finalName>${project.artifactId}</finalName>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-ant-plugin</artifactId>
+        <version>@pom.version@</version>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-clean-plugin</artifactId>
+        <version>2.2</version>
+        <configuration>
+          <filesets>
+            <fileset>
+              <directory>${basedir}</directory>
+              <includes>
+                <include>build.xml</include>
+                <include>maven-build.*</include>
+              </includes>
+            </fileset>
+          </filesets>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <version>1.1</version>
+        <configuration>
+          <tasks>
+          	<property name="maven.test.skip" value="true" />
+            <ant dir="${basedir}" antfile="${basedir}/build.xml" target="test" />
+          </tasks>
+        </configuration>
+        <dependencies>
+          <dependency>
+            <groupId>ant</groupId>
+            <artifactId>ant-junit</artifactId>
+            <version>1.6.5</version>
+          </dependency>
+          <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>3.8.2</version>
+          </dependency>
+        </dependencies>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.2</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <properties>
+    <build.compiler>extJavac</build.compiler>
+  </properties>
+
+</project>

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/src/test/java/it/SkippedTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/src/test/java/it/SkippedTest.java?rev=640113&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/src/test/java/it/SkippedTest.java (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/src/test/java/it/SkippedTest.java Sat Mar 22 15:52:46 2008
@@ -0,0 +1,37 @@
+package it;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Id$
+ */
+public class SkippedTest
+    extends TestCase
+{
+
+    public void testFail()
+        throws Exception
+    {
+        fail( "This test should have been skipped." );
+    }
+
+}

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/src/test/java/it/SkippedTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/src/test/java/it/SkippedTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/verify.bsh?rev=640113&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/verify.bsh (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/verify.bsh Sat Mar 22 15:52:46 2008
@@ -0,0 +1,14 @@
+import java.io.*;
+import java.util.*;
+
+try
+{
+    // nothing to verify, tests would have failed to build if not skipped
+}
+catch( Throwable t )
+{
+    t.printStackTrace();
+    return false;
+}
+
+return true;

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/verify.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/skip-test-execution-it/verify.bsh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java?rev=640113&r1=640112&r2=640113&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java (original)
+++ maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java Sat Mar 22 15:52:46 2008
@@ -731,9 +731,9 @@
         {
             writer.startElement( "target" );
             writer.addAttribute( "name", "compile-tests" );
-            AntBuildWriterUtil.addWrapAttribute( writer, "target", "depends", "junit-present, compile", 2 );
+            AntBuildWriterUtil.addWrapAttribute( writer, "target", "depends", "compile", 2 );
             AntBuildWriterUtil.addWrapAttribute( writer, "target", "description", "Compile the test code", 2 );
-            AntBuildWriterUtil.addWrapAttribute( writer, "target", "if", "junit.present", 2 );
+            AntBuildWriterUtil.addWrapAttribute( writer, "target", "unless", "maven.test.skip", 2 );
 
             writeCompileTasks( writer, project.getBasedir(), "${maven.build.testOutputDir}", testCompileSourceRoots,
                                project.getBuild().getTestResources(), "${maven.build.outputDir}", true );
@@ -774,15 +774,15 @@
         {
             writer.startElement( "target" );
             writer.addAttribute( "name", "test" );
-            AntBuildWriterUtil.addWrapAttribute( writer, "target", "depends", "junit-present, compile-tests", 2 );
-            AntBuildWriterUtil.addWrapAttribute( writer, "target", "if", "junit.present", 2 );
+            AntBuildWriterUtil.addWrapAttribute( writer, "target", "depends", "compile-tests, junit-missing", 2 );
+            AntBuildWriterUtil.addWrapAttribute( writer, "target", "unless", "junit.skipped", 2 );
             AntBuildWriterUtil.addWrapAttribute( writer, "target", "description", "Run the test cases", 2 );
 
             if ( !testCompileSourceRoots.isEmpty() )
             {
                 writer.startElement( "mkdir" );
                 writer.addAttribute( "dir", "${maven.test.reports}" );
-                writer.endElement(); //mkdir
+                writer.endElement(); // mkdir
 
                 writer.startElement( "junit" );
                 writer.addAttribute( "printSummary", "yes" );
@@ -857,9 +857,38 @@
             AntBuildWriterUtil.writeLineBreak( writer, 2, 1 );
 
             writer.startElement( "target" );
-            writer.addAttribute( "name", "junit-present" );
+            writer.addAttribute( "name", "test-junit-status" );
             AntBuildWriterUtil.addWrapAttribute( writer, "target", "depends", "test-junit-present", 2 );
-            AntBuildWriterUtil.addWrapAttribute( writer, "target", "unless", "junit.present", 2 );
+            writer.startElement( "condition" );
+            writer.addAttribute( "property", "junit.missing" );
+            writer.startElement( "and" );
+            writer.startElement( "isfalse" );
+            writer.addAttribute( "value", "${junit.present}" );
+            writer.endElement(); // isfalse
+            writer.startElement( "isfalse" );
+            writer.addAttribute( "value", "${maven.test.skip}" );
+            writer.endElement(); // isfalse
+            writer.endElement(); // and
+            writer.endElement(); // condition
+            writer.startElement( "condition" );
+            writer.addAttribute( "property", "junit.skipped" );
+            writer.startElement( "or" );
+            writer.startElement( "isfalse" );
+            writer.addAttribute( "value", "${junit.present}" );
+            writer.endElement(); // isfalse
+            writer.startElement( "istrue" );
+            writer.addAttribute( "value", "${maven.test.skip}" );
+            writer.endElement(); // istrue
+            writer.endElement(); // or
+            writer.endElement(); // condition
+            writer.endElement(); // target
+
+            AntBuildWriterUtil.writeLineBreak( writer, 2, 1 );
+
+            writer.startElement( "target" );
+            writer.addAttribute( "name", "junit-missing" );
+            AntBuildWriterUtil.addWrapAttribute( writer, "target", "depends", "test-junit-status", 2 );
+            AntBuildWriterUtil.addWrapAttribute( writer, "target", "if", "junit.missing", 2 );
 
             writer.startElement( "echo" );
             writer.writeText( StringUtils.repeat( "=", 35 ) + " WARNING " + StringUtils.repeat( "=", 35 ) );

Modified: maven/plugins/trunk/maven-ant-plugin/src/site/apt/examples/fail-missing-junit.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/site/apt/examples/fail-missing-junit.apt?rev=640113&r1=640112&r2=640113&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/site/apt/examples/fail-missing-junit.apt (original)
+++ maven/plugins/trunk/maven-ant-plugin/src/site/apt/examples/fail-missing-junit.apt Sat Mar 22 15:52:46 2008
@@ -45,10 +45,10 @@
   <!-- Unit testing, overridden to fail upon missing JUnit                    -->
   <!-- ====================================================================== -->
 
-  <target name="junit-present" 
-          depends="test-junit-present" 
-          unless="junit.present">
-    <property name="ant.libdir" location="${ant.home}/lib" />
+  <target name="junit-missing" 
+          depends="test-junit-status" 
+          if="junit.missing">
+    <property name="ant.libdir" location="${ant.home}/lib"/>
     <echo level="error">==================================== ERROR ====================================</echo>
     <echo level="error"> JUnit is not present in your $ANT_HOME/lib directory, aborting build.         </echo>
     <echo level="error"> Please copy "junit.jar" to "${ant.libdir}".                                   </echo>

Added: maven/plugins/trunk/maven-ant-plugin/src/site/apt/examples/skip-tests.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/site/apt/examples/skip-tests.apt?rev=640113&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/site/apt/examples/skip-tests.apt (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/site/apt/examples/skip-tests.apt Sat Mar 22 15:52:46 2008
@@ -0,0 +1,37 @@
+ ------
+ Skipping Unit Tests
+ ------
+ Benjamin Bentmann
+ ------
+ March 2008
+ ------
+
+ ~~ Copyright 2006 The Apache Software Foundation.
+ ~~
+ ~~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~~ you may not use this file except in compliance with the License.
+ ~~ You may obtain a copy of the License at
+ ~~
+ ~~      http://www.apache.org/licenses/LICENSE-2.0
+ ~~
+ ~~ Unless required by applicable law or agreed to in writing, software
+ ~~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~~ See the License for the specific language governing permissions and
+ ~~ limitations under the License.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/guides/mini/guide-apt-format.html
+
+
+Skipping Unit Tests
+
+ Although not recommended as a general practice, you sometimes may want to skip the unit tests when packaging the
+ artifact. Starting with Ant Plugin 2.1, the generated Ant build files allow this via the system property
+ <<<maven.test.skip>>>:
+
++-----+
+ant package -Dmaven.test.skip=true
++-----+
+
+ The above command will both skip the compilation of the unit tests and their execution.

Propchange: maven/plugins/trunk/maven-ant-plugin/src/site/apt/examples/skip-tests.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-ant-plugin/src/site/apt/examples/skip-tests.apt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/plugins/trunk/maven-ant-plugin/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/site/apt/index.apt?rev=640113&r1=640112&r2=640113&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/site/apt/index.apt (original)
+++ maven/plugins/trunk/maven-ant-plugin/src/site/apt/index.apt Sat Mar 22 15:52:46 2008
@@ -49,3 +49,5 @@
    * {{{examples/run-single-test.html}Running Individual Unit Tests}}
 
    * {{{examples/fail-missing-junit.html}Failing the Build if JUnit is Missing}}
+
+   * {{{examples/skip-tests.html}Skipping Unit Tests}}

Modified: maven/plugins/trunk/maven-ant-plugin/src/site/site.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/site/site.xml?rev=640113&r1=640112&r2=640113&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/site/site.xml (original)
+++ maven/plugins/trunk/maven-ant-plugin/src/site/site.xml Sat Mar 22 15:52:46 2008
@@ -35,6 +35,7 @@
       <item name="Customizing Ant Build Files" href="/examples/customize.html"/>
       <item name="Running Individual Unit Tests" href="/examples/run-single-test.html"/>
       <item name="Failing if JUnit is Missing" href="/examples/fail-missing-junit.html"/>
+      <item name="Skipping Unit Tests" href="/examples/skip-tests.html"/>
     </menu>
   </body>
 </project>