You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by ba...@goodconsultants.com on 2004/04/03 23:04:01 UTC

how can i undeclare taskdef?

All,

I have problems with taskdef being ran twice or more. How can i avoid the 
situation? Where should I place my taskdef? 

Can i actually "undeclare" what has been defined? I am interested in 
undeclaring the "jasper2" task.

Thanks

Barry

Here is the related code:

    <taskdef classname="org.apache.jasper.JspC" name="jasper2" 
onerror="ignore">
        <classpath id="jspc.classpath">
        <pathelement location="${java.home}/lib/tools.jar"/>
        <fileset dir="${catalina.home}/bin">
        <include name="*.jar"/>
        </fileset>
        <fileset dir="${catalina.home}/server/lib">
        <include name="*.jar"/>
        </fileset>
        <fileset dir="${catalina.home}/common/lib">
        <include name="*.jar"/>
        </fileset>
        </classpath>
    </taskdef>
    
    <jasper2 validateXml="false" uriroot="${basedir}/${precom-webapp.path}"
            webXmlFragment="${basedir}/${precom-webapp.path}/WEB-
INF/generated_web.xml"
            outputDir="${basedir}/${precom-webapp.path}/WEB-INF/src" />






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


RE: how can i undeclare taskdef?

Posted by Rainer Noack <ra...@noacks.net>.
magic property is 
ant.reuse.loader

> -----Original Message-----
> From: Rainer Noack [mailto:rainer@noacks.net] 
> Sent: Saturday, April 03, 2004 11:19 PM
> To: 'Ant Users List'
> Subject: RE: how can i undeclare taskdef?
> 
> 
> Hi Barry,
> I'm not sure in 1.6 but there should be no problems with 
> declaring the same task twice as this should be ignore if the 
> same class (from the same classloader) is using. As you're 
> using the implicitely creation of an own classloader for this 
> task, this may be the problem. (there is a magic property 
> that controls reuse of classpath classloaders but i've 
> forgotten it's name.) however, you can place your taskdef 
> inside a target (like init) and use the depends attribute to 
> make sure it runs only once. AFAIK you can not undeclare a 
> taskdef but you can "redeclare" it (maybe with a dummy). 
> Regards Rainer
> 
> > -----Original Message-----
> > From: barry@goodconsultants.com [mailto:barry@goodconsultants.com]
> > Sent: Saturday, April 03, 2004 11:04 PM
> > To: ant
> > Subject: how can i undeclare taskdef?
> > 
> > 
> > All,
> > 
> > I have problems with taskdef being ran twice or more. How can
> > i avoid the 
> > situation? Where should I place my taskdef? 
> > 
> > Can i actually "undeclare" what has been defined? I am interested in
> > undeclaring the "jasper2" task.
> > 
> > Thanks
> > 
> > Barry
> > 
> > Here is the related code:
> > 
> >     <taskdef classname="org.apache.jasper.JspC" name="jasper2"
> > onerror="ignore">
> >         <classpath id="jspc.classpath">
> >         <pathelement location="${java.home}/lib/tools.jar"/>
> >         <fileset dir="${catalina.home}/bin">
> >         <include name="*.jar"/>
> >         </fileset>
> >         <fileset dir="${catalina.home}/server/lib">
> >         <include name="*.jar"/>
> >         </fileset>
> >         <fileset dir="${catalina.home}/common/lib">
> >         <include name="*.jar"/>
> >         </fileset>
> >         </classpath>
> >     </taskdef>
> >     
> >     <jasper2 validateXml="false"
> > uriroot="${basedir}/${precom-webapp.path}"
> >             webXmlFragment="${basedir}/${precom-webapp.path}/WEB-
> > INF/generated_web.xml"
> >             
> > outputDir="${basedir}/${precom-webapp.path}/WEB-INF/src" />
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 


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


RE: how can i undeclare taskdef?

Posted by Rainer Noack <ra...@noacks.net>.
Hi Barry,
I'm not sure in 1.6 but there should be no problems with
declaring the same task twice as this should be ignore
if the same class (from the same classloader) is using.
As you're using the implicitely creation of an own classloader
for this task, this may be the problem. (there is a magic
property that controls reuse of classpath classloaders but
i've forgotten it's name.)
however, you can place your taskdef inside a target (like init)
and use the depends attribute to make sure it runs only once.
AFAIK you can not undeclare a taskdef but you can "redeclare"
it (maybe with a dummy).
Regards
Rainer

> -----Original Message-----
> From: barry@goodconsultants.com [mailto:barry@goodconsultants.com] 
> Sent: Saturday, April 03, 2004 11:04 PM
> To: ant
> Subject: how can i undeclare taskdef?
> 
> 
> All,
> 
> I have problems with taskdef being ran twice or more. How can 
> i avoid the 
> situation? Where should I place my taskdef? 
> 
> Can i actually "undeclare" what has been defined? I am interested in 
> undeclaring the "jasper2" task.
> 
> Thanks
> 
> Barry
> 
> Here is the related code:
> 
>     <taskdef classname="org.apache.jasper.JspC" name="jasper2" 
> onerror="ignore">
>         <classpath id="jspc.classpath">
>         <pathelement location="${java.home}/lib/tools.jar"/>
>         <fileset dir="${catalina.home}/bin">
>         <include name="*.jar"/>
>         </fileset>
>         <fileset dir="${catalina.home}/server/lib">
>         <include name="*.jar"/>
>         </fileset>
>         <fileset dir="${catalina.home}/common/lib">
>         <include name="*.jar"/>
>         </fileset>
>         </classpath>
>     </taskdef>
>     
>     <jasper2 validateXml="false" 
> uriroot="${basedir}/${precom-webapp.path}"
>             webXmlFragment="${basedir}/${precom-webapp.path}/WEB-
> INF/generated_web.xml"
>             
> outputDir="${basedir}/${precom-webapp.path}/WEB-INF/src" />
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 


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