> From: Mariano Benitez [mailto:[EMAIL PROTECTED] > > but ... If I call "typedef" for the same file, with the same > task, same > uri, etc, why it redefine the tasks if they are already defined? > > BTW, it could help an "unless" attribute for typedef, not to > do it again :) > <typedef resource="fuego/internal/test/ant/antlib.xml" > uri="antlib:fuego.internal.test.ant" > loaderRef="fuego.internal.test" > classpathref="fuego.internal.test.antlibs.path" unless="defined"/> > <property name="defined" value="true"/> >
I would advocate for a new condition: <isdefined {uri="<uri>" | name="[<NS>:]<name>"} /> Which is true for "uri" if there are things already defined in that uri; and for "name" if there is a definition already associated with that name (in te particular NS). This should include all kinds of definitions typedefs, macros, selectors, mappers, etc. We should add a "role" also once that issue is sorted out. Jose Alberto > MAriano > > Peter Reilly wrote: > > > Hi Mariano, > > I assume you are calling the "typedef" commands multiple times. > > - hence the different antloaders. But you only need to typedef the > > types/tasks once. > > > > You should wrap the taskdefs in a macrodef or a target, > > and call them once in the master build file before doing > > any subant, or ant calls. > > > > Peter > > > > Mariano Benitez wrote: > > > >> I am at the edge of a mental crisis, I need help.... > >> > >> > >> Can someone explain how antlib paths and tasks works, I have this > >> situation that I cannot understand. > >> > >> > >> I defined this: > >> > >> <project name="fuego.internal.test.include" basedir="."> > >> > >> <property name="xml.encoding" value="ISO-8859-1"/> > >> <path id="fuego.internal.test.antlibs.path"> > >> <fileset dir="${fuego.basedir}/lib"> > >> <include name="fuegoexpress-antlib.jar"/> > >> <include name="fuegoenterprise-antlib.jar"/> > >> <include name="fuegoj2ee-antlib.jar"/> > >> <include name="fuego-test-antlib.jar"/> > >> </fileset> > >> </path> > >> <typedef resource="fuego/internal/test/ant/antlib.xml" > >> uri="antlib:fuego.internal.test.ant" > >> loaderRef="fuego.internal.test" > >> classpathref="fuego.internal.test.antlibs.path"/> > >> <typedef resource="fuego/tools/ant/enterprise/antlib.xml" > >> uri="antlib:fuego.tools.ant.enterprise" > >> loaderRef="fuego.internal.test" > >> classpathref="fuego.internal.test.antlibs.path"/> > >> <typedef resource="fuego/tools/ant/express/antlib.xml" > >> uri="antlib:fuego.tools.ant.express" > >> loaderRef="fuego.internal.test" > >> classpathref="fuego.internal.test.antlibs.path"/> > >> <typedef resource="fuego/tools/ant/j2ee/antlib.xml" > >> uri="antlib:fuego.tools.ant.j2ee" > >> loaderRef="fuego.internal.test" > >> classpathref="fuego.internal.test.antlibs.path"/> > >> </project> > >> > >> another Jar "fuegocore.jar" is in the classpath manifest of those > >> jars, inside the fuegocore jar there is a clas "Loader". > >> > >> When I am executing one of the tasks in the antlib I do this. > >> > >> Inside an Utils.class static method: > >> task.log("[LOADERS] Loader Class [" + > Loader.class.hashCode() > >> + "/" + Loader.class.getClassLoader() + "]"); > >> task.log("[LOADERS] Utils Class [" + > Utils.class.hashCode() + > >> "/" + Utils.class.getClassLoader() + "]"); > >> > >> and this is the result I get when I run this multiple times in the > >> same ant run. > >> > >> [t:testsetup] [LOADERS] Loader Class > >> [6597453/[EMAIL PROTECTED] > >> [t:testsetup] [LOADERS] Utils Class > >> [19551658/[EMAIL PROTECTED] > >> > >> [t:testsetup] [LOADERS] Loader Class > >> [6597453/[EMAIL PROTECTED] > >> [t:testsetup] [LOADERS] Utils Class > >> [10520143/[EMAIL PROTECTED] > >> > >> [t:testsetup] [LOADERS] Loader Class > >> [6597453/[EMAIL PROTECTED] > >> [t:testsetup] [LOADERS] Utils Class > >> [28623319/[EMAIL PROTECTED] > >> > >> > >> > >> the thing is: WHY THE LOADER CLASS IS ALWAYS THE SAME > WHILE THE UTILS > >> CLASS IS ALWAYS IN DIFFERENT ANT CLASSLOADERS!!! > >> > >> Also, If I put a static {} block in the Loader class it is invoked > >> many times, not only one as it should, being the same > class the one > >> being returned. > >> > >> Please help, I cannot understand what is causing this and the > >> side-effect is that I get OutOfMemory errors when I run > nightly batch > >> tests. > >> > >> > >> Everything is appreciated. > >> > >> MAriano > >> > >> > --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > >> > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]