AppfuseQuickStart

类别:Java 点击:0 评论:0 推荐:

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

本文地址:http://com.8s8s.com/it/it15216.htm