Bug 58914

Summary: Enhance target with a new runOnce="true/[false]" attribute
Product: Ant Reporter: Robert Flaherty <robert.flaherty>
Component: CoreAssignee: Ant Notifications List <notifications>
Status: NEW ---    
Severity: enhancement    
Priority: P2    
Version: 1.9.6   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Robert Flaherty 2016-01-22 18:02:44 UTC
Multiple calls to a target will be reduced when called via the "depends" tree resolution, but if a target is called with antcall/runtarget, a target will be rerun.  By creating a property and checking for it with "unless" I worked around this, but having an internal method to control it might be useful.

<project name="test" default="task2">
	<target name="init" unless="stop">
		<echo message="init" />
		<property name="stop" value="now" />
	</target>
	
	<target name="task1" depends="init">
		<echo message="task1" />
	</target>
	
	<target name="task2" depends="init">
		<echo message="task2" />
		<antcall target="task1" />
	</target>
</project>

This bug may be looking for similar functionality, but may also involve an actual bug.

https://bz.apache.org/bugzilla/show_bug.cgi?id=58886