ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Don Taylor <donald_l_taylor...@yahoo.com>
Subject Re: newbie unclear on concept
Date Fri, 13 Jul 2001 11:30:15 GMT
This is a known problem with the copy task. Your thinking is correct,
the two "bad" targets *should* have failed.

--- "Michael Weir (Transform Research)" <MWeir@TransRes.com> wrote:
> I'm new to Ant and am apparently unclear about a few things (only a
> few...).
> 
> If I have a build.xml file that looks like this:
> 
> <project name="XXX" default="buildAndTest" basedir=".">
> 	<target name="buildAndTest" 
> 			depends="badTarget1, badTarget2"
> 	>
> 		<echo>
> 			Build and Test is running...
> 		</echo>
> 	</target>
> 
> 	<target name="badTarget1">
> 		<copy file="X:\badfile.txt" tofile="X:\badfile2.txt" />
> 	</target>
> 
> 	<target name="badTarget2">
> 		<copy file="X:\badfile.txt" tofile="X:\badfile2.txt" />
> 	</target>
> </project>
> 
> I.e. the main target depends on two 'bad' targets.
> 
> I expected that the bad file copies would fail, and that the only
> target to
> execute would be badTarget.  Instead I get this:
> 
> Ant version 1.3 compiled on March 2 2001
> 
> Buildfile: build.xml
> Detected Java Version: 1.3
> Detected OS: Windows 2000
> parsing buildfile P:\CM_1_0\build.xml with URI =
> file:P:/CM_1_0/build.xml
> Project base dir set to: P:\CM_1_0
> Build sequence for target `buildAndTest' is [badTarget1, badTarget2,
> buildAndTest]
> Complete build sequence is [badTarget1, badTarget2, buildAndTest]
> 
> badTarget1:
>      [copy] Could not find file X:\badfile.txt to copy.
> 
> badTarget2:
>      [copy] Could not find file X:\badfile.txt to copy.
> 
> buildAndTest:
>      [echo]
>                         Build and Test is running...
> 
> 
> BUILD SUCCESSFUL
> 
> Total time: 1 second
> 
> I assume that there's a way to tell when a target has failed, and to
> cause
> the parent target to fail as well, I just can't seem to see how.
> 
> Any help would be appreciated.
> Thanks,
> Michael Weir
> 


=====
Don

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

Mime
View raw message