----- Original Message ----- From: "Geir Magnusson Jr." <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, October 01, 2001 4:16 AM Subject: Classloader question
> Howdy, > > I am trying to get rid of the issues that popped up recently with Ant 1.4 > and Velocity. I will phrase the question generally... > > How do I, in a custom Ant task, dependably access the 'task classloader'? > > Here's the issue I believe I am facing. Suppose I have the following : > > <target name="foo"> > > <taskdef name="texen" > classname="org.apache.velocity.texen.ant.TexenTask"> > <classpath> > <pathelement location="../test/texen-classpath/test.jar"/> > <path refid="classpath"/> > </classpath> > </taskdef> > > <texen > useClassPath="true" > contextProperties="service.props" > controlTemplate="Control.vm" > outputDirectory="../test/texen-classpath/results" > outputFile="report" > /> > </target> > > Now, in the Texen code, I want to, via a classloader, access the stuff added > to the classpath defined in the <taskdef/>. > > What we were doing was something on the order of > > ClassLoader cl = this.getClass().getClassLoader(); > > But that doesn't fly in 1.4 as it appears that 1.4 delegates upwards for > classloading (rather than downwards...) I may have the interpretation of > the cause wrong - the symptom is that if you put the jar with Texen (the > velocity.jar) in the classpath before invoking ant, you get the problem. If > you don't, all is fine. > > So what I want to do is ensure I always get the 'lower' classloader (or find > another solution.) > > Thanks. > > Geir > > > -- > Geir Magnusson Jr. [EMAIL PROTECTED] > System and Software Consulting > "They that can give up essential liberty to obtain a little temporary safety > deserve neither liberty nor safety." - Benjamin Franklin > > >
