I've recently discovered that there are several useful templates (in Eclipse) that can be added to the script. And among them "public target" and "private target". And here the templates:
public target
<!-- =================================
target: name
================================= -->
<target name="name" depends="depends" description="description">
</target>
private target
<!-- - - - - - - - - - - - - - - - - -
target: name
- - - - - - - - - - - - - - - - - -->
<target name="name">
</target>
And i don't get it. What is the main difference? And what does the private target mean? Is it some specific feature in ant scripts or just code beautifying?
Just interesting.
Online documentation and books say that target is a stage of the entire build process, while task is the smallest unti of work.
A target is a container of tasks and datatypes that cooperate to reach a desired state during the build process. Targets can depend on other targets and Apache Ant ensures that these other targets have been executed before the current target.
A target which has a description is public because it appears when you execute
ant -projecthelp
The others are considered private because they don't appear by default.
Here's an example
<project name="public_only" default="public">
<target name="-private">
<echo message="private" />
</target>
<target name="public" description="this task is public" depends="-private">
<echo message="public" />
</target>
</project>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With