ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Chalko <n...@chalko.com>
Subject Re: Using classloader for Junit
Date Thu, 19 Jun 2003 07:49:38 GMT
Btw
I can make this work if I  include junit.jar and ant-junit.jar in the path.

And hack AntClassloader.

    private boolean isParentFirst(String resourceName) {
        // default to the global setting and then see
        // if this class belongs to a package which has been
        // designated to use a specific loader first
        // (this one or the parent one)

        // XXX - shouldn't this always return false in isolated mode?

        boolean useParentFirst = parentFirst;
// HERE IS MY HACK
        if 
(resourceName.startsWith("org.apache.tools.ant.taskdefs.optional.")) 
{return useParentFirst;}

       for (Enumeration e = systemPackages.elements(); 
e.hasMoreElements();) {
            String packageName = (String) e.nextElement();
            if (resourceName.startsWith(packageName)) {
                useParentFirst = true;
                log(resourceName+" is a system package["+packageName+" 
in"+systemPackages+"] use parent loader",Project.MSG_DEBUG);
                break;
            }
        }

        for (Enumeration e = loaderPackages.elements(); 
e.hasMoreElements();) {
            String packageName = (String) e.nextElement();
            if (resourceName.startsWith(packageName)) {
                useParentFirst = false;
                log(resourceName+" is a loader package use this 
loader",Project.MSG_DEBUG);
                break;
            }
        }

        return useParentFirst;
    }




Mime
View raw message