ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Reilly <peter.rei...@corvil.com>
Subject Re: Antlib & ClassLoading issues
Date Tue, 04 May 2004 08:57:00 GMT
Hi,
I did not know that the coreloader was actually used.
See:
http://marc.theaimsgroup.com/?l=ant-dev&m=107451990930463&w=2
for some discussion on this.

Be that as is may, if the coreloader is in the code, it should be
passed to the child projects.

As a work-around, you could trigger the loading of the antlib
tasks and types
in the initial project: For example add a macro to the
antlib : "init"

<macrodef name="init">
  <sequential>
  </sequential>
</macrodef>

 and call it in the initial project:

<project xmlns:s="antlib:com.company.project" default="subs">
  <s:init/>
  <target name="subs">
    <subant ../>
  </target>
</project>

It may be better to do something like this in any case, otherwise the tasks/types
will be loaded in each of the sub-projects.

Peter

Claude Vedovini wrote:

>I all,
>
>I am just trying to take advantage of the Antlib feature and it seems that
>in certain circumstances it does not work as expected :-)
>
>Ok, here is the background:
>
>We built a nice continuous integration infrastructure using ant, which is
>driven by a web application (our build launcher, currently running with
>Websphere, Weblogic and Tomcat) we also developed some tasks that are
>automatically put in the context of the build by our launcher.
>Grosso-modo the launcher is a servlet that creates a Project instance,
>configures it and so on.
>As you can imagine it also uses the setCoreLoader method to give the Project
>the web-app ClassLoader (which is a non-delegating J2EE ClassLoader).
>All this used to work since two years or so...
>
>Those last days I tried to promote out own tasks to an Antlib library in
>order to take advantage of the namespace stuff and here is the problem I ran
>into:
>
> - When I declare my antlib: namespace in a "sub" build (called via the
><ant> task) I got a ClassNotFoundException (and Ant tells me that I
>certainly forgot to add a jar in the lib folder)
>
>I took a look at the <ant> task and it seems that the CoreLoader of the
>calling project (which should further be used to load tasks I guess) is not
>passed through to the called project. Taskdefs are, which explains why it
>was working previously, but as I guess that antlibs are loaded on request
>(when the namespace declaration is met) and using the project's ClassLoader
>then my tasks' classes are no more in the scope.
>
>I am not 100% sure the problem lies where I think, so if someone could have
>a look (or two) at that issue I think it could help (at least me ;-)
>
>
>Thanks in advance,
>Claude
>__________________________________________________________________________
>* This email and any files transmitted with it are CONFIDENTIAL and intended
>solely for the use of the individual or entity to which they are addressed.
>* Any unauthorized copying, disclosure, or distribution of the material
>within
>this email is strictly forbidden.
>* Any views or opinions presented within this e-mail are solely those of the
>author and do not necessarily represent those of Odyssey Asset Management
>Systems SA unless otherwise specifically stated.
>* An electronic message is not binding on its sender.  Any message referring
>to
>a binding engagement must be confirmed in writing and duly signed.
>* If you have received this email in error, please notify the sender
>immediately
>and delete the original.
>
>  
>


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


Mime
View raw message