开发者

Ant Replace Task in FTP Files

Is there a way to 开发者_如何转开发call the Ant replace task on files in an FTP? I have a project with some static IDs in the code that change depending on whether I am on development platform or production. I setup my and build.xml file to copy all my files to FTP, but I need to change those static IDs either on the way to the FTP or when they hit it.


Ant doesnot have inbulit replace task. I achieved it by calling "del" first and than used "put", as below.

<ftp action="del" server="%ftpservername%" userid="%ftpserver_user%" password="%ftpserver_pwd%">
    <fileset>
                <include name="%file1%.db" />
                <include name="%file2%.db" />
    </fileset>
</ftp>  
<ftp action="put" retriesAllowed="-1" remotedir="%dest_dir%" server="%ftpservername%" port="%ftpport%" userid="%ftpserver_user%" password="%ftpserver_pwd%" binary="yes">
     <fileset dir="%src_dir%">
                <include name="%file1%.db" />
                <include name="%file2%.db" />
    </fileset>          
</ftp>

we can also do for directory which is in ant.apache.org


If you are looking to do replace within the ant ftp task, it looks like this is not supported. But you could do a replace followed by ftp.

<replace dir="${ftp.src} token="@@@" value="replaced"/>
<ftp server="server" userid="user" password="password">
    <fileset dir="${ftp.src}"/>
</ftp>

Or perhaps you are looking for something different.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜