copy multiple files in ant build file

W

wong_powah

My ant build file is:
....
<target name="mybin">
<exec executable = "make" dir = "${build.dir}/mybin/src" >
</exec>
<copy file="${build.dir}/mybin/src/activateContainer" todir="$
{bin.dir}"/>
<copy file="${build.dir}/mybin/src/assignContainer" todir="$
{bin.dir}"/>
<copy file="${build.dir}/mybin/src/copyContainer" todir="$
{bin.dir}"/>
<copy file="${build.dir}/mybin/src/createContainer" todir="$
{bin.dir}"/>
....
</target>

Instead of listing each binary file one by one for copying, is there a
shorter way of copying them?
 
Z

zzantozz

My ant build file is:
...
<target name="mybin">
<exec executable = "make" dir = "${build.dir}/mybin/src" >
</exec>
<copy file="${build.dir}/mybin/src/activateContainer" todir="$
{bin.dir}"/>
<copy file="${build.dir}/mybin/src/assignContainer" todir="$
{bin.dir}"/>
<copy file="${build.dir}/mybin/src/copyContainer" todir="$
{bin.dir}"/>
<copy file="${build.dir}/mybin/src/createContainer" todir="$
{bin.dir}"/>
...
</target>

Instead of listing each binary file one by one for copying, is there a
shorter way of copying them?

Take a look at Ant's copy task and fileset type. In particular, here's
an example of using fileset with copy to copy several files without
listing them individually:
<copy todir="../dest/dir">
<fileset dir="src_dir">
<exclude name="**/*.java"/>
</fileset>
</copy>

See: <http://ant.apache.org/manual/CoreTasks/copy.html>
and: <http://ant.apache.org/manual/CoreTypes/fileset.html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top