ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Loehr, Ruel" <>
Subject RE: classcast exception when attempting to use cachepath task
Date Tue, 23 Jan 2007 17:13:00 GMT
Excellent.  Great answer.

-----Original Message-----
From: Xavier Hanin [] 
Sent: Tuesday, January 23, 2007 10:44 AM
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
> it works.    I can then print out the classpath reference.  Later on
> though, when I attempt to use that same classpathref it throws an
> 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
classpath manually, you can have a build very independent from Ivy. Once
retrieve step has been done, it doesn't rely on Ivy anymore, and thus
pretty easy to get rid of Ivy for a build delivery for instance. With
cachepath task on the other hand you use directly jars from the cache
thus avoid a copy, but then heavily rely on Ivy for your classpath,
it harder to build or use your project without Ivy (in your IDE for


> Ruel Loehr
> -----Original Message-----
> From: Steve Loughran []
> Sent: Tuesday, January 23, 2007 5:47 AM
> To:
> 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
> >> 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 = (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
> with
> > the same classloader as the class DefaultModuleDescriptor. How do
> 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
> to
> > identify the problem, please add an bug in JIRA.
> >
> If you declare types and tasks in separatate <taskdef> and <typedef>
> calls, you should force both into the same classloader instance by
> setting loaderRef="some-shared-string" in both declarations. otherwise
> ant loads them into differenct classloaders, even if the classpath is
> identical

View raw message