蚂蚁's profile阳光森林PhotosBlogListsMore Tools Help

Blog


    August, 2009

    Ant的作用

    Ant的作用还是很大的,如楼上说到的它可以用来做编译、部署、打包、测试等等工作,虽然现在的IDE环境已经集成了很多这样的功能,但是通常情况下我们还是会很频繁的使用到Ant,一般有这样一些原则:  
      1.如果你发现你的工作有有许多是每天要做的,或者是经常要反复执行的工作,那么可以考虑使用Ant,这样可以将这样的工作编写为Ant脚本,便于维护和定期执行  
      2.当你是系统管理员,或者部署人员时,可以考虑使用Ant  
      3.当你是测试人员,希望在夜晚离开公司时,自动执行一些单元测试,当白天到公司时就能看到结果时,可以考虑使用Ant  
      4.当你是版本管理人员时可以考虑使用Ant  
      总之,永远记住Ant只是一个工具,至于什么时候使用,什么时候不使用完全由人决定,工具的最大目的就是如何提高我们的效率,如果在你的实际工作中使用了Ant能提高你的工作效率那么就可以考虑使用它,反之则未必。

     

    也许你听到别人说起ant,一时冲动准备学习一下ant,当你看完了上边的第一个实例,也许你感觉ant真好,也许你感觉ant不过如此,得出这些结论都不能说错,虽然ant很好用,但并不是在任何情况下都是最好的选择,例如windows上有更多更简单,更容易使用的工具,比如eclipse+myeclipse eclipse+wtp等等,无论是编译,部署,运行使用起来比ant更容易,方便但有些情况则是ant发挥的好地方:
    1,服务器上部署的时候
    当你的程序开发完成,部署人员要部署在服务器上的时候,总不能因为因为安装一个程序就配置一个eclipse+myeclipse吧,ant在这个时候是个很好的选择,因为它小巧,容易配置,你带着你写好的build.xml到任何一台服务器上,只需要做简单的修改(一些设定,例如目录),然后一两个命令完成,这难道不是一件美好的事情吗。
    2,linux上,很多时候是这样的,程序开发是在windows下,但是程序要在linux或者unix上运行,在linux或者
    在unix(特别是unix上)部署是个麻烦的事情,这个时候ant的特点又出来了,因为ant是跨平台的,你在build.xml可以在大多数操作系统上使用,基本不需要修改。
    3,当服务器维护者不懂编程的时候
    很多人都有过这样的经历,使用你们程序的人,并不懂得写程序。你得程序因为版本更新,因为修正bug需要一次又一次得重新部署。这个时候你会发现教一个人是如此得困难。但是有ant后,你只需要告诉他,输入ant xxx等一两个命令,一切ok.
    以上是我遇到得一些情况。

    看完以上得情况,好好考虑一下,你是否需要使用ant,如果是继续。

    Comments

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    Trackbacks

    The trackback URL for this entry is:
    http://antsdong.spaces.live.com/blog/cns!CF43121027CEF87E!339.trak
    Weblogs that reference this entry
    • None