ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Can i call execute() on a std task from within a custom task?
Date Fri, 11 Apr 2003 23:17:07 GMT

Is it legal to call the Java API "execute()" method on a standard task
from within a custom task?  

For example, in my product, i have a list of jar files that i need to
create: say "a.jar", "b.jar", and "c.jar".  

I could do something like this...

    <target name="makejars">
        <jar destfile="a.jar">
            <fileset dir="${build.classdir}" includes="files_for_a_jar"/>
        <jar destfile="b.jar">
            <fileset dir="${build.classdir}" includes="files_for_b_jar"/>
        <jar destfile="c.jar">
            <fileset dir="${build.classdir}" includes="files_for_c_jar"/>

However, i'm creating a build pattern/system for multiple products in my
company, so at build time, i the definition of what jar files are to be
created is defined in a custom configuration file (that i already wrote a
custom parser for since it's not in anything "standard").  The jars i'm
creating are completly based in the configuration.  It could be anything
such as "a.jar", "b.jar", and "c.jar" like above...but it also could be
"a.jar", "c.jar", and d.jar...or even just "a.jar".

So i figured i'd write a custom task that would create the jar files.  I
could use my own logic to create the jar files, but i'd like to know if it
is "legal" for me to do something like this in the execute() method of my
custom task:

    public void execute() throws BuildException {
        org.apache.ant.taskdefs.Jar jar = new Jar();
        jar.setDestFile ( f );
        jar.addFileset ( fileset );



View raw message