Interesting... I've never seen pathelement used for selecting files to copy. I don't have ant installed on my Mac at home, so I couldn't play around with it, but I wonder if you should have used <patternset> instead to specify the files for your <copy> task.
<patternset id="filesToCopy"> <includes name="a.txt"/> <includes name="dir/b.txt"/> <patternset> <property name="verbose.flag" value="false"/> <property name="flattenFlag" value="false"/> <copy todir="dest" flatten="${flatten.flag}" verbose="${verbose.flag}"> <fileset dir="${from.dir}> <patternset refid="filesToCopy"/> <fileset/> </copy> On Dec 1, 2007 1:27 AM, Maffitt, David <[EMAIL PROTECTED]> wrote: > I have a directory with contents: > build.xml > a.txt > dir/b.txt > > The content of build.xml is: > > <project name="testant" basedir="." default="testcopy" > > > <path id="filesToCopy" > > <pathelement location="a.txt" /> > <pathelement location="dir/b.txt" /> > </path> > > <target name="testcopy" > > <copy todir="dest" flatten="true"> > <resources> > <path refid="filesToCopy" /> > </resources> > </copy> > </target> > > </project> > > > When flatten is true, all is good and the directory 'dest' is created > with a.txt and b.txt. > > When flatten is false, I hoped to get the directory dest with contents > a.txt and dir/b.txt. Instead the directory 'dest' is not created and I > get: > > [EMAIL PROTECTED] testant]$ ant -v > Apache Ant version 1.7.0 compiled on April 1 2007 > Buildfile: build.xml > Detected Java version: 1.5 in: /usr/java/jdk1.5.0_11/jre > Detected OS: Linux > parsing buildfile /home/dmaffi01/projects/testant/build.xml with URI = > file:/hom > e/dmaffi01/projects/testant/build.xml > Project base dir set to: /home/dmaffi01/projects/testant > [antlib:org.apache.tools.ant] Could not load definitions from resource > org/apach > e/tools/ant/antlib.xml. It could not be found. > Build sequence for target(s) `testcopy' is [testcopy] > Complete build sequence is [testcopy, ] > > testcopy: > [copy] /home/dmaffi01/projects/testant/a.txt omitted as > /home/dmaffi01/proj > ects/testant/a.txt is up to date. > [copy] /home/dmaffi01/projects/testant/dir/b.txt omitted as > /home/dmaffi01/ > projects/testant/dir/b.txt is up to date. > [copy] No sources found. > > BUILD SUCCESSFUL > Total time: 0 seconds > > > HUH? How can a.txt and dir/b.txt be up to date when their destination > doesn't > exist yet? This seems too fundamental to be a bug so could someone > straighten > me out? > > I understand from other threads that the missing antlib.xml is not a > problem. > I tried updating ant.jar anyway. There missing antlib.xml warning went > away > but the behavior remained the same. > > Thanks in advance, > > -Dave > > The materials in this message are private and may contain Protected > Healthcare Information. If you are not the intended recipient, be advised > that any unauthorized use, disclosure, copying or the taking of any action > in reliance on the contents of this information is strictly prohibited. If > you have received this email in error, please immediately notify the sender > via telephone or return mail. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- -- David Weintraub [EMAIL PROTECTED]