Skipped targets are still executed

  • Share
  • Share

Applies to:
Ant

Description:
Occurs while using Apache Ant.

Cause:
You have a target You want to skip if a property is set, so You have unless=”property” as an attribute of the target, but all the targets this target depends on are still executed.

JAVA-Tools

  1. admin
    March 20th, 2009 at 10:28 | #1

    The list of dependencies is generated by Ant before any of the targets are run. This allows dependent targets, such as an init target, to set properties that can control the execution of the targets higher in the dependency graph. This is a good thing.
    However, when your dependencies break down the higher-level task into several smaller steps, this behaviour becomes counter-intuitive. There are a couple of solutions available:
    1. Put the same condition on each of the dependent targets.
    2. Execute the steps using , instead of specifying them inside the depends attribute.

  1. No trackbacks yet.