appFuse2.x第一篇

AppFuse is an open source project and application that uses open source tools built on the Java platform to help you develop Web applications quickly and efficiently. It was originally developed to eliminate the ramp-up time found when building new web applications for customers. At its core, AppFuse is a project skeleton, similar to the one that's created by your IDE when you click through a wizard to create a new web project.

AppFuse 1.x uses Ant to create your project, as well as build/test/deploy it. AppFuse 2.0 uses Maven 2 to create your project as well as build/test/deploy it. IDE support is much better in 2.0 because you can generate the IDE project files with Maven plugins. AppFuse 1.x uses XDoclet and JDK 1.4+.

AppFuse 2.0 is a restructuring of AppFuse 1.x to use Maven 2 and JDK 5 and annotations. The major reasons we've changed to Maven 2 are:

  • Dependency downloading
  • Easier maintenance (everything can be compiled at once)
  • Easier upgrading for end-users

To see our progress to date, please see the roadmap. If you'd like to help out or ask questions about AppFuse 2.0, please do so on the user mailing list. If you'd like to try your luck with AppFuse 2.0, see the Hello World Screencast and use the QuickStart Guide to get started.

New features in AppFuse 2.0:

  • Maven 2 Integration
  • Upgraded WebWork to Struts 2
  • JDK 5, Annotations, JSP 2.0, Servlet 2.4
  • JPA Support
  • Generic CRUD backend
  • Full Eclipse, IDEA and NetBeans support
  • Fast startup and no deploy with Maven Jetty Plugin
  • Testable on multiple appservers and databases with Cargo and profiles
The latest milestone release for 2.0 is M5. Try it out today!
The latest stable release of AppFuse is 1.9.4. Please see the 1.9.4 QuickStart Guide to get started with this release.

Please use the menu on the right to navigate this site. 

-------------------------------------quick start------------------------------------------------

要开始用 AppFuse 2.x 进行开发,请参照一下说明步骤:

 目录

1、创建一个新的工程。

2、运行它。

3、用 Appfuse 开发自己的工程。

 创建工程

1、下载安装 JDK5 或以上版本。

2、下载安装 Mysql5.x 。 

3、建立一个本地的 STMP 服务器,或者修改 mail.properties(在 src/main/resources 目录下),使之使用另外一个不同的主机名,它默认是使用的主机名是 "localhost"。

4、下载安装Maven 2.0.6 。

如果和在命令行下创建工程比起来,你更喜欢在eclipse创建自己的工程,你可以检出 Candy for AppFuse


5、AppFuse 带来了很多新的特性,为了简化和优化你的用户体验,我们已经提供了一系列典型的配置(也可以叫做start projects),现在这就有两类不同的典型配置:基本型和模块化类型。基本类型是为了创建web应用程序而建立的。模块化类型的配置包括"核心"组件 和"Web"组件,它是为了创建拥有可重用后端的工程而存在的。下边是创建各种工程的命令列表。你可以更改命令中出现的 groupId 以使之与你喜欢的包名相匹配,当然也可以更改 artifactId 以使它与你的工程名称匹配。

当你创建工程出现若干警告时是正常的,只要工程创建最后你看到 "BUILD SUCCESSFUL",你的工程就已经成功创建了。

配置类型
命  令
JSF Basic mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic-jsf -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0-m5 -DgroupId=com.mycompany.app -DartifactId=myproject
Spring MVC Basic mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic-spring -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0-m5 -DgroupId=com.mycompany.app -DartifactId=myproject
Struts 2 Basic mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic-struts -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0-m5 -DgroupId=com.mycompany.app -DartifactId=myproject
Tapestry Basic mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic-tapestry -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0-m5 -DgroupId=com.mycompany.app -DartifactId=myproject
JSF Modular mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-modular-jsf -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0-m5 -DgroupId=com.mycompany.app -DartifactId=myproject
Spring MVC Modular mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-modular-spring -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0-m5 -DgroupId=com.mycompany.app -DartifactId=myproject
Struts 2 Modular mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-modular-struts -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0-m5 -DgroupId=com.mycompany.app -DartifactId=myproject
Tapestry Modular mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-modular-tapestry -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0-m5 -DgroupId=com.mycompany.app -DartifactId=myproject
Core
(仅后端)
mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-core -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0-m5 -DgroupId=com.mycompany.app -DartifactId=myproject

如果你已经安装了  MySQL 5.x 数据库,并且它的root账户恰好没有密码,你就可以马上动手运行你的 AppFuse 了。假如你喜欢使用嵌入式数据库,我们最近已经添加了支持H2,HSQLDB等嵌入式数据库的配置。

MySQL 的安全性

以没有密码的 root 的账户运行 MySQL 是不安全的,一旦你创建了数据库,应该更改 root 的密码,命令如下:

  mysql --user=root --pass='' mysql -e "update user set password=password('newpw') where user='root'; flush privileges;"
 
AppFuse 默认使用没有密码的 root 账户运行,你可以通过修改工程pol.xml中的<jdbc.username> 和 <jdbc.password> 的属性来更改用户和用户的密码(这两个属性在pol.xml文件的底部)。

 运行工程

要运行 AppFuse 现在已经很容易了,一旦建立了项目原型,Maven会用hibernate3和dbunit的插件创建和生成数据库。现在你要做的就是用 Maven 运行 Jetty,然后查看你的工程。

1、 在命令行下,cd 到你的工程目录下,运行 mvn integration-test ,这个命令会完成相关 jar 包和 Tomcat 的下载,运行你的工程的集成测试。现在你可以休息一会,喝杯咖啡,因为上面的命令大概需要5-10分钟。

运行成功之后,访问 http://localhost:8080/myproject出现javax.servlet.ServletException: Failure when attempting to set Content-Encoding: gzip,对于这个问题网上有帖子子说ehcache的版本问题, 如果使用1.2.X,须改成使用1.3.0,但我通过蔽掉web.xml中gzipFilter可以正确运行

2、在你的工程目录下运行 mvn jetty:run-war ,你就可以去查看你的工程了。Maven 会启动 Jetty,这样的话,你就可以用这个地址: http://localhost:8080 在你的浏览器中查看你的工程了。如果你使用的是模块化原型,你需要在你的工程的 web 目录下运行 mvn jetty:run-war

管理员的默认用户名/密码为 admin/admin ,普通用户的话,可以用 user/user 登录。


Here are the different goals available to call on this cargo Maven2 plugin:

Goals Description
cargo:start Start a container and optionally deploy deployables (WAR, EAR, etc)
cargo:stop Stop a container
cargo:deployer-deploy (aliased to cargo:deploy) Deploy a deployable to a running container
cargo:deployer-undeploy (aliased to cargo:undeploy) Undeploy a deployable from a running container
cargo:deployer-start Start a deployable already installed in a running container
cargo:deployer-stop Stop a deployed deployable without undeploying it
cargo:deployer-redeploy Undeploy and deploy again a deployable
cargo:uberwar Merge several WAR files into one
cargo:install Installs a container distribution on the file system. Note that this is performed automatically by the cargo:start goal


参考http://cargo.codehaus.org/Maven2+plugin


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值