使用 Apache ANT 部署 Web 应用程序?

问题描述:

我刚刚能够在我的计算机上运行 Apache ANT.ant -version commando 输出版本号,验证安装是否顺利.

I was just able to get Apache ANT running on my computer. The ant -version commando outputs the version number , verifying that the installation went well.

我读过 ANT 非常适合处理网络部署包括 PHP 项目在内的应用程序,并花了一些时间让它工作,但我无法理解如何设置它以将我的文件同步到我的网络服务器.

I have read that ANT is well suited to handle deployment of web applications including PHP projects and have spent some time to get it working, but I just can't get my head around how to set it up to sync my files to my web server.

如何让 ANT 将 folderAfolderB 同步?

How can I make ANT sync folderA with folderB ?

谢谢

上次我检查(很久以前)Ant 中没有远程同步任务(只有 本地).您将不得不 编写一个调用 rsync 的 shell 脚本改为从 Ant 执行 this.但是有许多远程任务.您可以从 VCS 中查看您的代码,而不是将其同步到服务器.

Last time I checked (long ago) there was no remote sync task in Ant (only local). You would have to write a shell script that calls rsync and execute this from Ant instead. There is a number of remote tasks though. And you could check out your code from your VCS instead of syncing it to the server.

在旁注中,您可能需要考虑 Phing 而不是 Ant.它是 Ant 到 PHP 的一个端口.它有一个 FileSync 任务.您还可以添加自己的任务(用 PHP 编写),通常用于 PHP 的持续集成服务器.

On a sidenote, you might want to consider Phing over Ant. It's a port of Ant to PHP. It has a FileSync Task. You can also add your own Tasks (written in PHP) and is commonly used in Continuous Integration servers for PHP.

另请参阅您首选的 PHP 部署策略是什么其他人.