ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yves Martin <yves.mar...@elca.ch>
Subject How can I get the ClassLoader that loaded a URI ?
Date Thu, 25 Nov 2004 15:35:53 GMT

   Hello,

 I'm creating complex tasks with Ant and my problem can sumup to the question
 in subject.

 What I'm trying to do:

 1.  a.jar loaded in 'uri:a' with a 'loadclass' task declared. 'loadclass' will
     work with implementation of 'mycontract' interface.

   If I use <a:loadclass name="myclass" xmlns:a="uri:a"/> with myclass included
   in a.jar and implementing the 'mycontract' interface, it works - I use a
   simple Class.forName to get it.

 2. b.jar loaded in 'uri:b' with another class 'bclass', implementing
    'mycontract'.

   <a:loadclass name="bclass" xmlns:a="uri:a"/> does not work. Of course,
   bclass.class is not in 'loadclass' ClassLoader - so Class.forName is not
   enough.

 I would like to improve my task to do:
   <a:loadclass name="bclass" sourceuri="uri:b" xmlns:a="uri:a"/>

 That's way, 'loadclass' can lookup for the "uri:b" ClassLoader and loads
 "bclass".

 How can I lookup for a URI ClassLoader ? Thanks in advance.

 'myclass' and 'bclass' are not tasks but simple POJO. If they were tasks, it
 is "easy" to execute them from its respective URI. I'm looking for a way to
 keep them POJO.

 Best regards,
-- 
Yves Martin


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message