appfuse mysql_Appfuse 教程

AppFuse 是一个开源项目,主要目的是使用开源工具来帮助开发者快速有效的建立Web应用项目。使用AppFuse可以减少开发人员在建立新web应用时候花费大量时间在项目结构的建立上。 最核心的是, AppFuse是一个项目的骨架,类似图使用IDE的向导方式来创建web项目。

AppFuse 2 的环境配置:

a. 安装JDK 5+ (确保JAVA_HOME 指向JDK目录, 而不是JRE目录).

b. 安装 MySQL 5.x.

c. 建立本地SMTP服务或者修改mail.properties (在src/main/resources) 的use为一个不同的主机名- it 缺省是 "localhost".

d. 安装Maven 2.0.9+.

因为AppFuse 2使用了Maven 2 的支持。一般的Maven2 会再你使用AppFuse的包的时候会下载这些包,但是如果你的网络不好的话。你也可以自己下载AppFuse2的依赖包,其下载地址为:https://appfuse.dev.java.net/servlets/ProjectDocumentList?folderID=9173&expandFolder=9173&folderID=9173,现在版本是AppFuse2.02.大小为80M多。

然后解压到某个文件夹下,然后修改Maven_Home下的/conf/settings.xml里的相应配置,设置本地资源库。

E:/appfusedeps/repository

需要注意的上面的配置里说默认的资源库路径为~/.m2/repository,这是指用户的home目录,但如果这样设置在windows下,会产生一些问题,因为windows的用户目录在C:\Documents and Settings下,而这个目录有空格,所以最好直接指定另外的没有空格的英文路径。

下面是创建不同种类项目的Archetype Command:

1.JSF Basic

mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-jsf -DremoteRepositories=http://static.appfuse.org/releases-DarchetypeVersion=2.0 -DgroupId=com.mycompany.app -DartifactId=myproject

2.Spring MVC Basic

mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-spring -DremoteRepositories=http://static.appfuse.org/releases-DarchetypeVersion=2.0 -DgroupId=com.mycompany.app -DartifactId=myproject

3. Struts 2 Basic

mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-struts -DremoteRepositories=http://static.appfuse.org/releases-DarchetypeVersion=2.0 -DgroupId=com.mycompany.app -DartifactId=myproject

4. Tapestry Basic

mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-tapestry -DremoteRepositories=http://static.appfuse.org/releases-DarchetypeVersion=2.0 -DgroupId=com.mycompany.app -DartifactId=myproject

5. JSF Modular

mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-modular-jsf -DremoteRepositories=http://static.appfuse.org/releases-DarchetypeVersion=2.0 -DgroupId=com.mycompany.app -DartifactId=myproject

6.Spring MVC Modular

mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-modular-spring -DremoteRepositories=http://static.appfuse.org/releases-DarchetypeVersion=2.0 -DgroupId=com.mycompany.app -DartifactId=myproject

7.Struts 2 Modular

mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-modular-struts -DremoteRepositories=http://static.appfuse.org/releases-DarchetypeVersion=2.0 -DgroupId=com.mycompany.app -DartifactId=myproject

8.Tapestry Modular

mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-modular-tapestry -DremoteRepositories=http://static.appfuse.org/releases-DarchetypeVersion=2.0 -DgroupId=com.mycompany.app -DartifactId=myproject

9.Core(backend only)

mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-core -DremoteRepositories=http://static.appfuse.org/releases-DarchetypeVersion=2.0 -DgroupId=com.mycompany.app -DartifactId=myproject

下面将举一个例子:

1. 在D盘创建一个目录D:\projects\

2. 启动cmd。进入目录D:\projects\.

3.执行如下建构命令创建基本的:

mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-struts -DremoteReposities=http://static.appfuse.org/release -Darchetypeversion=2.0.1 -DgroupId=com.zhangjr.framework -DartifactId=myproject

4.执行结束后将会看到D:\projects\myproject目录结构,编辑D:\projects\myproject\pom.xml,修改mysql数据连接信息,主要是修改root的密码为你自己数据库用户密码

因为缺省为空。

5.在cmd中进入目录D:\projects\myproject

6.执行mvn jetty:run-war

7.等执行结束后,在浏览器地址栏输入http://localhost:8080/,你将会看到项目的界面,任意输入一个用户名和密码即可登入。

571f562a0c7907018f65764703ae097c.png

8.登入进去以后,不错吧。你的新项目不写一行代码就完成了吧。呵呵。

3fcd9665a8412efb87088cbf993bf1f5.png

9.你可以运行mvn appfuse:full-source,则会创建数据库,并且生成代码。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值