On Thu, Aug 13, 2009 at 3:09 PM, Scot P. Floess <sflo...@nc.rr.com> wrote:
> > I was under the impression that using an unless attribute on a target will > not run the target if that property is set... However, if there are is a > depends attribute defined, the targets in the depend are run regardless? > Remember: Ant is not a programming language, but a build system that uses a dependency matrix to determine the build order. Unlike a programming language, you do not specify the actual build order of your targets. Instead, you merely state that one target depends upon another. Ant then uses this information to actually determine the build order. Ant builds this dependency matrix first before even looking at what is required to execute the targets. Your example, although is an excellent test, isn't that realistic since you are passing the "stop" property on the command line itself. More likely, the property is set by a previous dependent target execution. However, let's assume that I do want to use that property on the command line to determine whether or not to execute a specific target. Let's say that my build file looks like this: <project> <target name="compile"/> <target name="package depends="compile"/> <target name="compress" unless="dont-compress" depends="package"/> <target name="deploy" depends="compress"/> </project> In this example, I want to execute my "deploy" target. Normally, I want to do my compress step which removes debugging information from my software package. However, sometimes, for debugging purposes, I need to install my package with debugging information. I could execute this: $ ant -Ddont-compress deploy In this case, I do want to execute my "compile" and "package" targets before I do my deployment. However, I don't want the compress target to execute. If I pre-tested my property "dont-compress" and because of that, I decided not to execute my compile and package, the deploy target would fail. -- David Weintraub qazw...@gmail.com