ant 脚本中私有目标和公共目标的区别
我最近发现有几个有用的模板(在 Eclipse 中)可以添加到脚本中。其中包括“公共目标”和“私人目标”。这里的模板:
公共目标
<!-- =================================
target: name
================================= -->
<target name="name" depends="depends" description="description">
</target>
私有目标
<!-- - - - - - - - - - - - - - - - - -
target: name
- - - - - - - - - - - - - - - - - -->
<target name="name">
</target>
我不明白。主要区别是什么? 私有目标是什么意思?是 Ant 脚本中的某些特定功能还是只是代码美化?
很有趣。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
具有描述的目标是公共的,因为它会在您执行时出现
。其他目标被视为私有,因为默认情况下它们不会出现。
A target which has a description is public because it appears when you execute
The others are considered private because they don't appear by default.
这是一个例子
Here's an example
虽然
您经常希望调用内部/私有目标来运行构建中的一小步(特别是在开发新功能时),但如果目标是私有的,则无法执行此操作。所以你最终创建了第二个公共目标来调用私有目标......并且最终你的构建文件的大小增加了一倍。
while
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.