早就想看看Appfuse了,但一直没时间。借着Appfuse 2的发布,把它提到日程上来。
话不多说,先上官网,照着Quick Start Guide ( http://appfuse.org/display/APF/AppFuse+QuickStart)create my first appfuse project step by step。下面只给出大致步骤,详细信息还得看官网的Quick Start Guide。
一个中文文档的网站:
http://www.chq.name/content/category/10/81_49.html
准备工作
1) JDK 5 or later
2) Mysql 5.x
3) SMTP Server (对于首次接触appfuse,忽略这一步)
4) Maven 2.0.x (如何使用maven参见 http://blog.csdn.net/totogogo/archive/2007/12/13/1933659.aspx)
Create the first Appfuse project
Appfuse包含多个使用不同框架的project,下面以Struts 2 project为例。
1) Check maven runs well
mvn –version
2) Create Struts 2 Basic project by running follow command:
mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-struts -DremoteRepositories=http://static.appfuse.org/releases -DarchetypeVersion=2.0.1 -DgroupId=com.mycompany.app -DartifactId=myproject
完成之后,在执行下一步之前,启动mysql。注意:如果mysql root account’s password is not empty, modify the <jdbc.username> and
<jdbc.password> properties in your project's pom.xml first
3) cd the project (created by step 2) root folder, run following command to :
mvn
注意:运行期间可能会出错,不需要理会
4) run following command是为上面创建的project生成war,并把它配置到jetty web server上运行:
mvn jetty:run-war
该命令是把war file deploy to jetty server,
那么当你对你
project
里的
file
(如
jsp or servlet
)修改后,需要重新执行
mvn jetty:run-war
来重新
deploy
。
如果你想即改即可反映到
jetty server
的话,你就需要执行
step 5(参看官网提供的vedio)
5) 非war file deploy:
a) 执行命令:
mvn war:inplace 来把dependent war的内容extract到你的project的src/main/webapp目录下
b) (非常重要的一步)
删除
src/main/webapp/WEB-INF/lib
目录和
src/main/webapp/WEB-INF/classes/struts.xml
文件(if you're using Struts),
没有这步的话,执行下面的命令mvn jetty:run会出错
c) 执行命令:
mvn jetty:run
Appfuse
与
IDE
Appfuse 2目前只和IDEA( http://www.jetbrains.com/)集成得好,与Eclipse集成目前还会有这样那样的问题,而且Appfuse的eclipse plugin:Candy( http://candy4appfuse.sourceforge.net/Welcome.html)目前为止也没搞好。与Netbean的集成没试过。
与IDEA集成: http://appfuse.org/display/APF/IDEA
与ECLIPSE集成: http://appfuse.org/display/APF/Eclipse
与NETBEAN集成: http://appfuse.org/display/APF/NetBeans
注:如何使用
IDEA
来使用
APPFUSE
,强烈建议参看官方提供的
video
。