Browse Source

Don't lie about the CLASSPATH being used - build.sysclasspath changes

everything.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270617 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 23 years ago
parent
commit
a8d83a4528
2 changed files with 21 additions and 2 deletions
  1. +18
    -0
      src/main/org/apache/tools/ant/AntClassLoader.java
  2. +3
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java

+ 18
- 0
src/main/org/apache/tools/ant/AntClassLoader.java View File

@@ -398,6 +398,24 @@ public class AntClassLoader extends ClassLoader implements BuildListener {
pathComponents.addElement(pathComponent); pathComponents.addElement(pathComponent);
} }
/**
* The CLASSPATH this classloader will consult.
*/
public String getClasspath() {
StringBuffer sb = new StringBuffer();
boolean firstPass = true;
Enumeration enum = pathComponents.elements();
while (enum.hasMoreElements()) {
if (!firstPass) {
sb.append(System.getProperty("path.separator"));
} else {
firstPass = false;
}
sb.append(((File) enum.nextElement()).getAbsolutePath());
}
return sb.toString();
}

/** /**
* Set this classloader to run in isolated mode. In isolated mode, classes not * Set this classloader to run in isolated mode. In isolated mode, classes not
* found on the given classpath will not be referred to the base class loader * found on the given classpath will not be referred to the base class loader


+ 3
- 2
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -564,9 +564,10 @@ public class JUnitTask extends Task {
AntClassLoader cl = null; AntClassLoader cl = null;
Path classpath = commandline.getClasspath(); Path classpath = commandline.getClasspath();
if (classpath != null) { if (classpath != null) {
log("Using CLASSPATH " + classpath, Project.MSG_VERBOSE);

cl = new AntClassLoader(null, project, classpath, false); cl = new AntClassLoader(null, project, classpath, false);
log("Using CLASSPATH " + cl.getClasspath(),
Project.MSG_VERBOSE);

// make sure the test will be accepted as a TestCase // make sure the test will be accepted as a TestCase
cl.addSystemPackageRoot("junit"); cl.addSystemPackageRoot("junit");
// will cause trouble in JDK 1.1 if omitted // will cause trouble in JDK 1.1 if omitted


Loading…
Cancel
Save