diff --git a/docs/junit.html b/docs/junit.html
index ff9774a48..3165109d7 100644
--- a/docs/junit.html
+++ b/docs/junit.html
@@ -70,8 +70,10 @@ elements.
junit
supports a nested <classpath>
element, that represents a PATH like
-structure. The value is ignore if fork
is
-disabled.
+structure. PATHs defined elsewhere can be referred to via nested
+<classpathref>
elements. The value is ignored if
+fork
is disabled.
jvmarg
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
index 76de6db82..f1832ed8a 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
@@ -61,6 +61,7 @@ import org.apache.tools.ant.taskdefs.*;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Reference;
import java.io.File;
import java.io.IOException;
@@ -87,6 +88,7 @@ import java.util.Vector;
public class JUnitTask extends Task {
private CommandlineJava commandline = new CommandlineJava();
+ private Vector classpathReferences = new Vector();
private Vector tests = new Vector();
private Vector batchTests = new Vector();
private Vector formatters = new Vector();
@@ -132,6 +134,14 @@ public class JUnitTask extends Task {
return commandline.createVmArgument();
}
+ /**
+ * Adds a reference to a CLASSPATH defined elsewhere - nested
+ * element.
+ */
+ public void addClasspathRef(Reference r) {
+ classpathReferences.addElement(r);
+ }
+
public Path createClasspath() {
return commandline.createClasspath(project);
}
@@ -170,6 +180,19 @@ public class JUnitTask extends Task {
boolean errorOccurred = false;
boolean failureOccurred = false;
+ Path classpath = commandline.createClasspath(project);
+ for (int i=0; i