Eclipse PDT,如何获取服务器上的文件? [英] Eclipse PDT, how do I get the files on the server?

查看:291
本文介绍了Eclipse PDT,如何获取服务器上的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想学习如何使用Eclipse Helios PDT,但我不明白如何将文件从他们的工作区到服务器。 PDT文档很稀疏。



我的工作区在/ home / bob / workspace,我的本地dev webroot是/ home / bob / public_html。

如果我为我的php项目设置运行配置,我看到我可以设置服务器的路径等,但我没有看到任何明显的方式来自动复制文件到我的webroot真正运行项目。如果我点击运行,我只是在浏览器中得到一个404。



例如,对于NetBeans,您可以配置一个PHP项目,以便在保存到本地Web服务器时复制,FTP配置到服务器等。PDT没有某种类似的功能?

解决方案

我从来没有真正使用源代码控制将文件推送到生产服务器,我做的是使用ANT。



我发现通过让工作区直接在服务器位置,它创建了很多隐藏文件,如果你使用源代码控制隐藏文件可以在每个目录中。我不觉得正确只是复制和粘贴这些到我的生产服务器...



所以:
我设置了我的工作区, spot,不在我的本地服务器上。当我准备好测试时,我运行ant脚本。此脚本将我想要的所有文件放到服务器上。



这里是我的本地ant脚本:

 <?xml version =1.0encoding =UTF-8?& 

< project default =initbasedir =。>

< target name =init>
< echo message =将文件复制到C:/ Sandbox / xampp / htdocs/>
< sync todir =C:/ Sandbox / xampp / htdocs>
< fileset dir =。>
< include name =** / *。html/>
< include name =** / *。htm/>
< include name =** / *。php/>
< include name =** / *。css/>
< include name =** / *。js/>
< include name =** / *。jpg/>
< include name =** / *。png/>
< include name =** / *。gif/>
< exclude name =env.php/>
< / fileset>
< / sync>
< / target>

< / project>

你会注意到我排除了一个名为env.php的文件。此文件包含特定的环境代码。例如数据库名称和本地和生产之间不同的数据库名称。



我意识到这是一个更多的步骤,而不仅仅是ctrl-s然后F5看本地变化,



有乐趣!


I am trying to learn how to use Eclipse Helios PDT, but I don't understand how one gets the files from their workspace to the server. The PDT documentation is painfully sparse.

I have my workspace in /home/bob/workspace and my local dev webroot is /home/bob/public_html.

If I set up a run configuration for my php project I see where I can set up the path to the server, etc, but I do not see any obvious way to auto copy the files to my webroot to actuallly run the project. If I click on run, I just get a 404 in the browser.

With NetBeans, for instance, you can configure a PHP project to copy on save to a local webserver, FTP to a server, etc. Does PDT not have some sort of similar functionality?

解决方案

I've never really used source control to push files to the production server, but that sounds interesting. What I do is use ANT.

I found that by having the workspace directly in the server location it creates a lot of hidden files, and if you are using source control these hidden files can be in every directory. I didn't feel right just copying and pasting these into my production server...

So: I set up my workspace to have the code in one spot, not on my local server. When I'm ready to test, I run the ant script. This script drops all the files that I want onto the server. Then if I feel it's ready to go, I just move these files to production (ftp or whatever).

Here is my ant script for local:

<?xml version="1.0" encoding="UTF-8"?>

<project default="init" basedir=".">

<target name="init">
    <echo message="Copying files to C:/Sandbox/xampp/htdocs"/>
    <sync todir="C:/Sandbox/xampp/htdocs">
        <fileset dir=".">
            <include name="**/*.html" />
            <include name="**/*.htm" />
            <include name="**/*.php" />
            <include name="**/*.css" />
            <include name="**/*.js" />
            <include name="**/*.jpg" />
            <include name="**/*.png" />
            <include name="**/*.gif" />
            <exclude name="env.php"/>
        </fileset> 
    </sync>
</target>

</project>

You will notice that I exclude a file called "env.php". This file contains the specific environment code. Things like database names and such that differ between local and production.

I realize it's one more step than just hitting ctrl-s then F5 to see changes locally, but it makes deploying it other places a lot simpler.

Have fun!

这篇关于Eclipse PDT,如何获取服务器上的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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