Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>An alternative to the answers you've already received is to create a custom task container that makes sure it does not repeat an action. I have such a custom task in <a href="http://wiki.github.com/dwdyer/uncommons-antlib/" rel="nofollow noreferrer">my personal Antlib</a>, but there's a whole load of other junk in there that you probably don't want, so maybe you could just copy <a href="http://github.com/dwdyer/uncommons-antlib/blob/master/src/java/main/org/uncommons/antlib/tasks/Once.java" rel="nofollow noreferrer">the source</a> and add it to your own project. It looks something like this:</p> <pre><code>import org.apache.tools.ant.Task; import org.apache.tools.ant.TaskContainer; import org.apache.tools.ant.BuildException; import java.util.List; import java.util.LinkedList; /** * Task container to ensure that some set of actions is only performed * once per build. On completion of the actions a property is set that * prevents subsequent executions. */ public class Once extends Task implements TaskContainer { private final List&lt;Task&gt; tasks = new LinkedList&lt;Task&gt;(); private String property; /** * The name of the property to consult in order to determine whether * the nested tasks should be performed. This is a required attribute. */ public void setProperty(String property) { this.property = property; } public void addTask(Task task) { tasks.add(task); } @Override public void execute() throws BuildException { if (property == null || property.length() == 0) { throw new BuildException("Property name must be specified."); } // If no value is specified, the tasks are performed if the property // is set to any value. If a value is specified, the tasks are only // performed if the property matches that value. if (getProject().getProperty(property) == null) { for (Task task : tasks) { task.perform(); } getProject().setProperty(property, "done"); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload