From ivy-user-return-302-apmail-incubator-ivy-user-archive=incubator.apache.org@incubator.apache.org Tue Jan 23 17:11:24 2007 Return-Path: Delivered-To: apmail-incubator-ivy-user-archive@locus.apache.org Received: (qmail 23545 invoked from network); 23 Jan 2007 17:11:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 Jan 2007 17:11:24 -0000 Received: (qmail 71890 invoked by uid 500); 23 Jan 2007 17:11:30 -0000 Delivered-To: apmail-incubator-ivy-user-archive@incubator.apache.org Received: (qmail 71863 invoked by uid 500); 23 Jan 2007 17:11:30 -0000 Mailing-List: contact ivy-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ivy-user@incubator.apache.org Delivered-To: mailing list ivy-user@incubator.apache.org Received: (qmail 71854 invoked by uid 99); 23 Jan 2007 17:11:29 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Jan 2007 09:11:29 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (herse.apache.org: local policy) Received: from [209.163.206.56] (HELO ptscorp-exch01.pointserve.com) (209.163.206.56) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Jan 2007 09:11:21 -0800 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Subject: RE: classcast exception when attempting to use cachepath task Date: Tue, 23 Jan 2007 11:13:00 -0600 Message-ID: <2706AD316A054049A19D18EE406678A314BD95@ptscorp-exch01.pointserve.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: classcast exception when attempting to use cachepath task Thread-Index: Acc/DcAlz4dgd52qS+q3X/4tBac19wAA9uqg From: "Loehr, Ruel" To: X-Virus-Checked: Checked by ClamAV on apache.org Excellent. Great answer. -----Original Message----- From: Xavier Hanin [mailto:xavier.hanin@gmail.com]=20 Sent: Tuesday, January 23, 2007 10:44 AM To: ivy-user@incubator.apache.org Subject: Re: classcast exception when attempting to use cachepath task On 1/23/07, Loehr, Ruel wrote: > > That was indeed what it was. When I give them all the same loader ref, > it works. I can then print out the classpath reference. Later on > though, when I attempt to use that same classpathref it throws an error > saying that it is unknown. I can't understand yet why it would > disappear when I attempt to use it from a different target. > > What is the best practice here? To let ivy dynamically create the > classpaths or to manually create them? It depends on your requirements. If you use ivy:retrieve and then build your classpath manually, you can have a build very independent from Ivy. Once the retrieve step has been done, it doesn't rely on Ivy anymore, and thus it's pretty easy to get rid of Ivy for a build delivery for instance. With the cachepath task on the other hand you use directly jars from the cache and thus avoid a copy, but then heavily rely on Ivy for your classpath, making it harder to build or use your project without Ivy (in your IDE for instance). Xavier Thanks! > Ruel Loehr > > -----Original Message----- > From: Steve Loughran [mailto:stevel@apache.org] > Sent: Tuesday, January 23, 2007 5:47 AM > To: ivy-user@incubator.apache.org > Subject: Re: classcast exception when attempting to use cachepath task > > Xavier Hanin wrote: > > On 1/22/07, Loehr, Ruel wrote: > >> > >> Hi. > > > > > > Hi > > > > I'm having a problem using the cachepath task. I receive a class cast > >> exception when I define it. I've researched the problem but cannot > have > >> not found a solution yet. > > > > > > You're problem is pretty strange, but I would bet it's a classloader > > problem. Indeed here is line 130: > > ModuleDescriptor reference =3D (ModuleDescriptor) > > getResolvedDescriptor(org, module, strict); > > > > And the CCE indicate that the class of the object is > > DefaultModuleDescriptor, which implements ModuleDescriptor. So it's > > presumably because the ModuleDescriptor interface has not been loaded > with > > the same classloader as the class DefaultModuleDescriptor. How do you > load > > Ivy in ant? Do you use a taskdef with a special classpath, or do you > put > > Ivy > > in your ant lib directory? And do you call ant with some kind of > recursive > > feature, like subant or ant tasks? If it is the case try to do > something > > very simple (like a single build file with ivy.jar in ant lib > directory > > only) to see if the problem comes from here or not. And if you manage > to > > identify the problem, please add an bug in JIRA. > > > > If you declare types and tasks in separatate and > calls, you should force both into the same classloader instance by > setting loaderRef=3D"some-shared-string" in both declarations. = otherwise > ant loads them into differenct classloaders, even if the classpath is > identical >