You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Jeroen Zwartepoorte <Je...@xs4all.nl> on 2000/11/11 21:38:38 UTC
copy task not working
Hi,
I'm a new ant user. I've got a build script which has a compile task which
does 2 things: compile all the .java files in a directory and copy a .gif
file to the output directory.
The second command doesn't get executed. Does anybody have any ideas what is
wrong?
Snippet from build.xml:
<target name="compile" depends="prepare">
<javac srcdir="${sourcePath}" destDir="${outputPath}"
classpathref="project.class.path" />
<copy file="{$sourcePath}/nl/xs4all/jeroen/jbuilder/anttool/ant.gif"
tofile="{$outputPath}/nl/xs4all/jeroen/jbuilder/anttool/ant.gif" />
</target>
Output from ant:
prepare:
[mkdir] Created dir: F:\Project\java\anttool\classes
compile:
[javac] Compiling 6 source files to F:\Project\java\anttool\classes
deploy:
Thanks,
Jeroen Zwartepoorte
Re: copy task not working
Posted by Jeroen Zwartepoorte <Je...@xs4all.nl>.
Thanks for the info. I managed to find & fix the problems:
- I was using {$variable} instead of the correct ${variable}.
- To know i did the above wrong, i got the latest version from cvs and that
version generated an error during the build. I was using the 1.2
distribution before that.
Jeroen
----- Original Message -----
From: "Stefan Bodewig" <bo...@bost.de>
To: <an...@jakarta.apache.org>
Sent: Monday, November 13, 2000 11:38 AM
Subject: Re: copy task not working
> Jeroen Zwartepoorte <Je...@xs4all.nl> wrote:
>
> > I've got a build script which has a compile task which does 2
> > things: compile all the .java files in a directory and copy a .gif
> > file to the output directory.
> >
> > The second command doesn't get executed. Does anybody have any ideas
> > what is wrong?
>
> I think it gets executed, but the target file already exists and is
> not older than the source file. In this case Ant will silently not
> copy anything (use the overwrite attribute if this is not what you
> want).
>
> For example:
>
> <project default="copytarget">
> <target name="copytarget">
> <copy file="testcopy.xml" tofile="foo.bar.xml" />
> </target>
> </project>
>
> bodewig@bodewig ~/jakarta/test >ant -f testcopy.xml
> Buildfile: testcopy.xml
>
> copytarget:
> [copy] Copying 1 file to /home/bodewig/jakarta/test
>
> BUILD SUCCESSFUL
>
> Total time: 1 second
>
>
> bodewig@bodewig ~/jakarta/test >ant -f testcopy.xml
> Buildfile: testcopy.xml
>
> copytarget:
>
> BUILD SUCCESSFUL
>
> Total time: 1 second
>
> The second invocation doesn't do anything, because nothing has
> changed in testcopy.xml.
>
> Stefan
>
Re: copy task not working
Posted by Stefan Bodewig <bo...@bost.de>.
Jeroen Zwartepoorte <Je...@xs4all.nl> wrote:
> I've got a build script which has a compile task which does 2
> things: compile all the .java files in a directory and copy a .gif
> file to the output directory.
>
> The second command doesn't get executed. Does anybody have any ideas
> what is wrong?
I think it gets executed, but the target file already exists and is
not older than the source file. In this case Ant will silently not
copy anything (use the overwrite attribute if this is not what you
want).
For example:
<project default="copytarget">
<target name="copytarget">
<copy file="testcopy.xml" tofile="foo.bar.xml" />
</target>
</project>
bodewig@bodewig ~/jakarta/test >ant -f testcopy.xml
Buildfile: testcopy.xml
copytarget:
[copy] Copying 1 file to /home/bodewig/jakarta/test
BUILD SUCCESSFUL
Total time: 1 second
bodewig@bodewig ~/jakarta/test >ant -f testcopy.xml
Buildfile: testcopy.xml
copytarget:
BUILD SUCCESSFUL
Total time: 1 second
The second invocation doesn't do anything, because nothing has
changed in testcopy.xml.
Stefan