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.
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>
private targets, i.e targets which could not be called by the user called in script itself
while
public can be called by user
you often want to call internal / private targets to run just a small step in the build (particularly while developing new features) – you can't do this if the targets are private. so you end up creating a second, public, target that calls the private target … and you end up doubling the size of your build files.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.