Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 35878 invoked from network); 11 Sep 2004 20:07:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 11 Sep 2004 20:07:51 -0000 Received: (qmail 40588 invoked by uid 500); 11 Sep 2004 20:07:47 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 39807 invoked by uid 500); 11 Sep 2004 20:07:42 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 39794 invoked by uid 99); 11 Sep 2004 20:07:42 -0000 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=HTML_60_70,HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from [198.152.13.100] (HELO tierw.net.avaya.com) (198.152.13.100) by apache.org (qpsmtpd/0.28) with ESMTP; Sat, 11 Sep 2004 13:07:41 -0700 Received: from tierw.net.avaya.com (localhost [127.0.0.1]) by tierw.net.avaya.com (Switch-3.1.2/Switch-3.1.0) with ESMTP id i8BK0R02021990 for ; Sat, 11 Sep 2004 15:00:27 -0500 (EST) Received: from cof110avexu1.global.avaya.com (h135-9-6-16.avaya.com [135.9.6.16]) by tierw.net.avaya.com (Switch-3.1.2/Switch-3.1.0) with ESMTP id i8BK0Q02021987 for ; Sat, 11 Sep 2004 15:00:26 -0500 (EST) X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C4983A.FC7981B5" Subject: classloading, ant, junit, more advanced question Date: Sat, 11 Sep 2004 14:07:38 -0600 Message-ID: <676171B29CCEA84FBE05EEA11935AE63046CADFA@cof110avexu1.global.avaya.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: classloading, ant, junit, more advanced question Thread-Index: AcSYOvxMWpqsfB+WQJydjWs9VkoB2w== From: "Hiller, Dean D (Dean)" To: X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N ------_=_NextPart_001_01C4983A.FC7981B5 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable One thing I get really nervous about is always having a junit.jar in ant/lib and then one in the project itself so the project compiles. I know, I know, classloader stuff. But I had a suggestion around some of that, and I think I have seen similar comments. =20 I only suggest this as I wrote an xml scripting framework that is more dynamic than ant(I didn't have the backwards compatibility baggage making my job much easier). Trying to open source this through my company, but that is another story. =20 Here is how my dream ant would work 1. junit would have an ant task and have some standard file ant/resource.xml and other jars could have the same file 2. junit is dropped into ant/lib or put in ant's classpath, or via a taskdef loaded in. 3. ant seeing this jar with a resource.xml automatically loads it in a different classloader(it has to actually otherwise it may get the resource.xml from a different jar on accident). It then configures itself and works. =20 4. The other option is someone does a taskdef with an attribute of jar=3D"junit.jar" They don't need to even know the classnames of the = tasks in the jar. That is all defined in the resource.xml. =20 =20 I have done this on a very similar scripting xml framework(I looked into jelly, but jelly didn't offer asynchronous tasks). This seems to work fine and would seem to solve your problems with the worry about users having a hard time. It would be quite simple. Drop your junit.jar into ant/lib, or in the classpath, or define in the build file. Either way, junit.jar would be loaded in a separate classloader. =20 You may be wondering, but wait a second, you put the junit.jar on the classpath. That means it is now already loaded in the parent loader. Well yes, BUT what my framework does to get around that is reload the same framework in another classloader that doesn't have a parent. Then I take each and every jar off the classpath and load each in it's own classloader getting a reference to it's resource.xml file. Basically, no matter which of the three mechanisms are used 1. junit.jar w/ant task inside it on classpath 2. junit.jar w/ant task inside it in ant/lib 3. junit.jar w/ant task insitde it defined in It is loaded in a separate classloader and the task and junit library are together. =20 Hopefully, I can drive the open source of this scripting framework through, and some could take a peak if they were curious. =20 Thanks, dean =20 =20 =20 ------_=_NextPart_001_01C4983A.FC7981B5--