2014年1月4日 星期六

Eclipse php copy to htdocs folder

1. create build.xml, put it in the project root folder

build.xml
---------------------------------------------
<?xml version="1.0" encoding = "UTF-8" ?>
<project name="project" default="deploy" basedir=".">
<property file="build.properties"></property>
<target name="deploy">
<delete dir="${full.deploy.path}"></delete>
<copy todir="${full.deploy.path}">
<fileset dir=".">
<exclude name="**/test/**"></exclude>
</fileset>
</copy>
</target>
</project>


2. create build.properities file, put it in the project root folder

build.properities
--------------------------------------------
apache.htdocs.dir=C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/
web.root.dir=product_catalog
full.deploy.path=${apache.htdocs.dir}/${web.root.dir}


3. Right click your project > properties > Builder > New > Ant Builder
    choose the build.xml you have just created > Apply
   
4. press Alt + F6 to build your project. Eclipse will output the project to htdocs folder

Yea~

Drawbacks:
1. deletes the htdocs and then copy from the source every time you build the project -> takes time!
2. htdocs/* cannot update the source (backward update)

If you have been using Netbeans, you don;t need the above scripts as there is an option "copy from the source to another folder" checkbox~


沒有留言:

張貼留言