Ant任务VS shell脚本 [英] Ant task vs Shell script

查看:392
本文介绍了Ant任务VS shell脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到在我的办公室的地方很多,其中 Ant任务用于从一个地方移动到另一个文件,也做这些一些任务这files.However所有可以用 shell脚本来完成

I see a lot of places in my office where ant tasks are used to move files from one place to another and also do some tasks on these files.However all this can be done with shell scripts.

我的问题是,

在什么情况下是蚂蚁 preferred超过 shell脚本

In what cases is ant preferred over shell scripts ?

什么是使用的好处蚂蚁超过 shell脚本做相同的一组任务。

What are the benefits of using ant over a shell scripts for doing same set of tasks.

一个优点蚂蚁有是,它适用于所有平台,除此之外还有什么性能相关优势?

One advantage ant has is that it works on all platforms,other than that are there any performance related advantages ?

推荐答案

您为何ANT应该是preferred shell脚本的问题是双重的:

Your question as to why ANT should be preferred to shell scripts is two-fold:


  1. ANT是已经实现了工具wides $ P $垫采用,并有可能
    已经安装在开发人员的工作站上。相比一
    它的主要predecessors,制作,ANT是很多更加规范,
    跨平台的。

  2. ANT是熟悉的开发工具。用于建立自己的code所以他们往往会延长ANT脚本来部署他们的应用程序如
    好。事实上,许多厂商都提供Ant任务用于这一目的。

有没有性能优势,真的。 Java是命令行用法慢。

There are no performance benefits, really. Java is slow for command-line usage.

但.....我建议不要打性能牌。让我们pretend您的应用程序不支持Windows(这是奇怪考虑一个Java应用程序应该支持所有plaforms ...):我看到shell脚本驱动的部署decend陷入混乱试图调和各种方式不同的UNIX操作系统命令工作。像焦油,AWK等命令可以微妙的不同而导致额外的平台支持逻辑脚本。

But..... I would advise against playing the "performance" card. Let's pretend that your application does not support windows (Which is odd considering a Java application should support all plaforms...): I have seen shell script driven deployments decend into chaos attempting to reconcile the various ways different unix operating system commands work. Commands like "tar", "awk", etc can be subtly different which leads to additional platform support logic in your script.

在最后,我会用也没有。我选择使用一般脚本常规的混合方法。它是一个基于Java的脚本语言和嵌入ANT的全部力量。作为一个基于Java的脚本语言,意味着它可以在所有平台上工作。在公平起见还应该指出的是,有其他语言选项。 Ruby是绝对值得一提,因为它催生了一系列的配置管理技术,是非常值得评价。 (请参见厨师并的木偶

In conclusion I would use neither. I choose a hybrid approach of using groovy for general scripting. It is a java based scripting language and embeds the full power of ANT. Being a java based scripting language means it will work on all platforms. In the interest of fairness it should also be noted that there are other language options. Ruby is certainly worthy of mention since it has spawned a set of configuration management technologies that are well worth evaluation. (See Chef and Puppet)

这篇关于Ant任务VS shell脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆