You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Gerrit ." <g9...@hotmail.com> on 2008/04/18 00:52:04 UTC

Apply task and multiple target files

Hi, I'm new to Ant. Maybe there's someone here who can point me to the relevant documentation or an example for my problem:


I'd like to call <apply> for an executable which needs to be passed multiple targets, whose names are derived from the source file. Two of these are actual filesystem paths, one is just a string parameter (also derived from the source filename). When I try to use a compositemapper, I get the error message that "apply doesn't support multiple targetfile elements."

Here's what I tried. It doesn't look quite right anyway, because the 3rd target param isn't really a file.


<apply executable="myexecutable">

    <arg value="-infile"/>
    <srcfile/>
    <arg value="-outfile1"/>
    <targetfile/>
    <arg value="-outfile2"/>
    <targetfile/>
    <arg value="-myparam"/>
    <targetfile/>
    
    <fileset dir="${my_dir}" includes="*.foo"/>
    
    <compositemapper>
        <mapper type="glob" from="*.foo" to="*.bar1"/>
        <mapper type="glob" from="*.foo" to="*.bar2"/>
        <mapper type="glob" from="*.foo" to="*_param"/>
    </compositemapper>
    
</apply>


Can someone help me?
Thanks in advance!



_________________________________________________________________
Discover the new Windows Vista
http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE

Re: Apply task and multiple target files

Posted by Matt Benson <gu...@yahoo.com>.
--- "Gerrit ." <g9...@hotmail.com> wrote:

> 
> Hi, I'm new to Ant. Maybe there's someone here who
> can point me to the relevant documentation or an
> example for my problem:
> 
> 
> I'd like to call <apply> for an executable which
> needs to be passed multiple targets, whose names are
> derived from the source file. Two of these are
> actual filesystem paths, one is just a string
> parameter (also derived from the source filename).
> When I try to use a compositemapper, I get the error
> message that "apply doesn't support multiple
> targetfile elements."
> 
> Here's what I tried. It doesn't look quite right
> anyway, because the 3rd target param isn't really a
> file.
> 

I don't know that we have an OOTB way to do what
you're asking.  I'd probably either wrap up the whole
command in something else like a macro, shell script,
Java class, <apply> (ExecuteOn) task subclass...
whatever you're comfortable with... and run that way. 
Sorry for the bad news.

-Matt

> 
> <apply executable="myexecutable">
> 
>     <arg value="-infile"/>
>     <srcfile/>
>     <arg value="-outfile1"/>
>     <targetfile/>
>     <arg value="-outfile2"/>
>     <targetfile/>
>     <arg value="-myparam"/>
>     <targetfile/>
>     
>     <fileset dir="${my_dir}" includes="*.foo"/>
>     
>     <compositemapper>
>         <mapper type="glob" from="*.foo"
> to="*.bar1"/>
>         <mapper type="glob" from="*.foo"
> to="*.bar2"/>
>         <mapper type="glob" from="*.foo"
> to="*_param"/>
>     </compositemapper>
>     
> </apply>
> 
> 
> Can someone help me?
> Thanks in advance!
> 
> 
> 
>
_________________________________________________________________
> Discover the new Windows Vista
>
http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE



      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

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