AppfuseQuickStart

AppFuse's main purpose is to help you quickly accelerate the start of your webapp. Here are the basic steps to creating a new

project with it.
------------------------------------------------------------------------------------------
Appfuse的主要目的是幫助你快速的開始你的WEB應用。本文說明了使用它建立一個新工程的基本步驟。
------------------------------------------------------------------------------------------

Download the source version or checkout the appfuse module from CVS (cvs -d :pserver:[email protected]:/cvs co appfuse).
Install J2SE 1.4+, set a JAVA_HOME environment variable, install Ant 1.6.1+, set an ANT_HOME environment variable.
Install MySQL 3.23.x+ (recommend 4.0.18) and Tomcat 4.1.x+ (recommend 5.0.24 with hotfix). Set a CATALINA_HOME environment

variable to point to your Tomcat installation. Optionally, you can see my development environment setup and get links to

download the above packages.
--------------------------------------------------------------------------------------------
下載源代碼或是從CVS檢出AppFuse模塊(cvs -d :pserver:[email protected]:/cvs co appfuse)。安裝J2SE1.4+,設置好JAVA_HOME環境

變量,安裝Ant1.6.1+,設置好ANT_HOME環境變量。安裝MySQL3.23.x+(建議4.0.18)以及TOMCAT4.1.X+(建議5.0.24補丁版)。設置一個

CATALINA_HOME環境變量以指出TOMCAT的安裝目錄。可選的,你可能參照我的開發環境設置並且取得下載以上包的鏈接地址。
------------------------------------------------------------------------------------------

Setup a local SMTP server or change mail.properties (in the web/WEB-INF/classes directory) and build.properties (in the root

-- for log4j messages) to point to an existing one - they default to localhost.
------------------------------------------------------------------------------------------
設置一個本地的SMTP服務器或是改變mail.properties文件(在web/WEB-INF/classes目錄下)及build.properties文件(在根目錄下,以改變

log4j的消息),以指出已有的SMTP服務器,默認是本地
------------------------------------------------------------------------------------------

Copy lib/junit3.8.1/junit.jar to $ANT_HOME/lib.
------------------------------------------------------------------------------------------
拷貝lib/junit3.8.1/junit.jar到 $ANT_HOME/lib。
------------------------------------------------------------------------------------------

Run ant new -Dapp.name=YOURAPPNAME -Ddb.name=YOURDBNAME. This will create a directory named YOURAPPNAME in the same directory

as appfuse.
------------------------------------------------------------------------------------------
運行ant new -Dapp.nae=你的APP名 -Ddb.name=你的數據庫名。這個步驟將對立一個名字<你的APP名>在與appfuse相同的目錄中
------------------------------------------------------------------------------------------

Navigate to the new directory and run ant setup to create the database and setup your app on Tomcat. The database setup will

only work if your root user has no password. You can change this in build.properties if necessary. If you want to test and

make sure everything works, run ant test-all - make sure Tomcat is stopped when you do this.
Run ant test-reports - there will be a message after it runs telling you how you can view the generated reports.
------------------------------------------------------------------------------------------
轉到新的目錄下,運行ant setup以建立這個數據庫,並且安裝你的應用程序在TOMCAT中。數據庫配置只有在你的root用戶沒有設置口令的情況

下才能工作。如果需要的話你可以在build.properties文件中改變它。如果你想測試並且運行ant test-reports -在它運行之後將會告訴你如

何能看本次運行的結果報告。
------------------------------------------------------------------------------------------

Optional Installations
------------------------------------------------------------------------------------------
可選的安裝
------------------------------------------------------------------------------------------

If you'd like to use iBATIS as a persistence framework option, view the README.txt in extras/ibatis.
If you'd like to use Spring as the web framework, view the README.txt in extras/spring.
If you don't want to install iBATIS or Spring MVC - you should delete extras/ibatis and extras/spring before checking your

project into source control.
------------------------------------------------------------------------------------------
如果你喜歡使用iBATIS作爲一個持久的框架,請看readme.txt在extras/ibatis
如果佻喜歡使用spring人微言輕web框架,請看readme.txt在extras/spring
如果你想安裝iBATIS或者Spring MVC ,你可以刪除extras/ibatis及extras/spring在你將你的應用檢入到source control前

 

--------------------------------------------------------------------------------


Usually, after you get all this to work - it's likely you'll want to change all your package names to "com.company" rather

than "org.appfuse". I use Eclipse to rename packages. To do this, go to the package view, click on a package name and right

click -> Refactor -> Rename. Type in "*.xml,*.properties,*.xdt" for File name patterns to search in.
------------------------------------------------------------------------------------------
通常,你可能會這麼去做-將你的包名改爲"com.company"而不是"org.appfuse",我一般使用Eclipse去重命名包名。做這項工作,進入到

package vies,點一個包名並且右鍵點擊 -> Refactor -> Rename。在文件搜索中輸入*.xml,*.properties,*.xdt"以查找出來。
------------------------------------------------------------------------------------------

NOTE: If you want to use iBATIS, I recommend you install it (instructions at extras/ibatis/README.txt) before renaming all

the packages. If you don't install it first, you can add the ibatis/src as a source directory and rename packages there. Make

sure to edit/change all the package names in the .xml files (including build.xml). You will also need to manually change the

package names in the *DAOiBatis files.
------------------------------------------------------------------------------------------
注意:如果你想使用iBATIS,我建議你安裝它(說明在extras/ibatis/readme.txt中)在改變所有的包名之前。如果你沒有先安裝它,你可以增

加ibatis/src作爲一個源代碼目錄,並且在那兒改包名。請確定在.xml文件(包括build.xml)中更改了所有的包名。你將需要手工更改包名在

DAOiBatis文件中
------------------------------------------------------------------------------------------

 

By adding "*.xml,*.properties,*.xdt" to the File name patterns field in the Rename Package wizard, the following files should

be changed as well. If you're not using Eclipse or something isn't working right - you might want to ensure the "org.appfuse"

has been changed to "com.company" in the following files:

- metadata/web/global-exceptions.xml
- web/WEB-INF/tiles-config.xml
- web/WEB-INF/classes/log4j.properties
- web/WEB-INF/validator-rules-custom.xml
- src/service/com/company/service/applicationContext-service.xml
- src/dao/com/company/dao/hibernate/applicationContext-hibernate.xml
- metadata/templates/struts_form.xdt
------------------------------------------------------------------------------------------
增加"*.xml,*.properties,*.xdt"到更包名嚮導的文件搜索域中,列出的文件將被自動更好。如果你不使用Eclipse或是有些部分沒有工作正確

,你需要確認"org.appfuse"在以下文件中被正確的改爲"com.company":
- metadata/web/global-exceptions.xml
- web/WEB-INF/tiles-config.xml
- web/WEB-INF/classes/log4j.properties
- web/WEB-INF/validator-rules-custom.xml
- src/service/com/company/service/applicationContext-service.xml
- src/dao/com/company/dao/hibernate/applicationContext-hibernate.xml
- metadata/templates/struts_form.xdt
------------------------------------------------------------------------------------------


You'll need to manually change the location of the Hibernate mapping files in the applicationContext-hibernate.xml file

(location listed above). Basically, "org/appfuse" needs to be changed to "com/company".
------------------------------------------------------------------------------------------
你將需要手動更改Hibernate映射文件位置在applicationContext-hibernate.xml文件(位置已在上面列出)。大體上,"org/appfuse"需要被改

爲"com/company"
------------------------------------------------------------------------------------------


You'll also need to change a few targets in build.xml to refer to the new package names. These targets/changes are listed

below:


- junitdoclet-module - change org.* to com.*
- javadoc - change org.* to com.*
------------------------------------------------------------------------------------------
你同時也需要改變一些targets在build.xml文件,以參照新的包名。這些targets/changes請看:
- junitdoclet-module - change org.* to com.*
- javadoc - change org.* to com.*
------------------------------------------------------------------------------------------

 

If you rename the org.appfuse.webapp.form package to, say test.web.form, you also have to edit the ConverterUtil in the

src/service package. Method getOpposingObject is your friend, take a look at

name = StringUtils.replace(name, "model", "webapp.form");
name = StringUtils.replace(name, "webapp.form", "model"); 
------------------------------------------------------------------------------------------
如果你重命名org.appfuse.webapp.form包爲test.web.form,你也需要編輯src/service包中的ConverterUtil。方法getOpposingObject在你的

友元中,請參照:

name = StringUtils.replace(name, "model", "webapp.form");
name = StringUtils.replace(name, "webapp.form", "model"); 




------------------------------------------------------------------
下載源代碼或是從CVS檢出AppFuse模塊(cvs -d :pserver:[email protected]:/cvs co appfuse)。安裝J2SE1.4+,設置好JAVA_HOME環境
變量,安裝Ant1.6.1+,設置好ANT_HOME環境變量。安裝MySQL3.23.x+(建議4.0.18)以及TOMCAT4.1.X+(建議5.0.24補丁版)。設置一個
CATALINA_HOME環境變量以指出TOMCAT的安裝目錄。可選的,你可能參照我的開發環境設置並且取得下載以上包的鏈接地址。
設置一個本地的SMTP服務器或是改變mail.properties文件(在web/WEB-INF/classes目錄下)及build.properties文件(在根目錄下,以改變
log4j的消息),以指出已有的SMTP服務器,默認是本地
拷貝lib/junit3.8.1/junit.jar到 $ANT_HOME/lib。
運行ant new -Dapp.nae=你的APP名 -Ddb.name=你的數據庫名。這個步驟將對立一個名字<你的APP名>在與appfuse相同的目錄中
轉到新的目錄下,運行ant setup以建立這個數據庫,並且安裝你的應用程序在TOMCAT中。數據庫配置只有在你的root用戶沒有設置口令的情況
下才能工作。如果需要的話你可以在build.properties文件中改變它。如果你想測試並且運行ant test-reports -在它運行之後將會告訴你如
何能看本次運行的結果報告。
可選的安裝
如果你喜歡使用iBATIS作爲一個持久的框架,請看readme.txt在extras/ibatis
如果佻喜歡使用spring人微言輕web框架,請看readme.txt在extras/spring
如果你想安裝iBATIS或者Spring MVC ,你可以刪除extras/ibatis及extras/spring在你將你的應用檢入到source control前
通常,你可能會這麼去做-將你的包名改爲"com.company"而不是"org.appfuse",我一般使用Eclipse去重命名包名。做這項工作,進入到
package vies,點一個包名並且右鍵點擊 -> Refactor -> Rename。在文件搜索中輸入*.xml,*.properties,*.xdt"以查找出來。
注意:如果你想使用iBATIS,我建議你安裝它(說明在extras/ibatis/readme.txt中)在改變所有的包名之前。如果你沒有先安裝它,你可以增
加ibatis/src作爲一個源代碼目錄,並且在那兒改包名。請確定在.xml文件(包括build.xml)中更改了所有的包名。你將需要手工更改包名在
DAOiBatis文件中
增加"*.xml,*.properties,*.xdt"到更包名嚮導的文件搜索域中,列出的文件將被自動更好。如果你不使用Eclipse或是有些部分沒有工作正確
,你需要確認"org.appfuse"在以下文件中被正確的改爲"com.company":
- metadata/web/global-exceptions.xml
- web/WEB-INF/tiles-config.xml
- web/WEB-INF/classes/log4j.properties
- web/WEB-INF/validator-rules-custom.xml
- src/service/com/company/service/applicationContext-service.xml
- src/dao/com/company/dao/hibernate/applicationContext-hibernate.xml
- metadata/templates/struts_form.xdt
你將需要手動更改Hibernate映射文件位置在applicationContext-hibernate.xml文件(位置已在上面列出)。大體上,"org/appfuse"需要被改
爲"com/company"
你同時也需要改變一些targets在build.xml文件,以參照新的包名。這些targets/changes請看:
- junitdoclet-module - change org.* to com.*
- javadoc - change org.* to com.*
如果你重命名org.appfuse.webapp.form包爲test.web.form,你也需要編輯src/service包中的ConverterUtil。方法getOpposingObject在你的
友元中,請參照:

name = StringUtils.replace(name, "model", "webapp.form");
name = StringUtils.replace(name, "webapp.form", "model"); 



原文請看:http://raibledesigns.com/wiki/Wiki.jsp?page=AppFuseQuickStart

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章