views:

185

answers:

2

Is there a way to copy files to a (temp directory on a) stageing server only if the build and the unit tests succeed?

A: 

For sure, just make it the last thing in your NAnt script.

Noon Silk
+3  A: 

Note that my answer is Maven2 oriented, so I am not completly sure that it will help you to solve your problem, but maybe be helpful for Java developers...

With Maven2, a build is failing if any unit test is failing (however, you have arguments to make the build successfull even with test failures).

You can then attach an Ant task that will copy some files into a directory. If you attach this Ant task in the package phase, it will be run after the compilation and the test phase, and then will be executed only if these steps are successfull.

Note that if you want to deploy your artifact (i.e. "copy" the WAR into a Tomcat server, for example), there are plugin for that (check Cargo plugin for example).

romaintaz
romaintaz: Note he's using .net (hence 'NAnt' and MSBuild in the title).
Noon Silk
Yes, I just saw that after posting my answer. However, I will keep my answer as it may be useful for other persons who uses Maven2...
romaintaz
Yeah, no worries, it also appears to be the accepted one, which I find a little confusing, but you can't argue with the OP :P
Noon Silk