下载appfuse2.0源码有两种方法
一种是找到他的cvs下载。
还有一种就是用maven下载,就是appfuse2.0官网上介绍的下载方法。
好了,现在我们开始下载appfuse2.0的源码,用第二钟方法:
1、下载安装 JDK5 或以上版本。
2、下载安装 Mysql5.x 。
3、建立一个本地的 stmp服务器,或者修改 mail.properties(在 src/main/resources 目录下),使之使用另外一个不同的主机名,它默认是使用的主机名是 "localhost"。(这一步如果不是急需可以先省略,等对appfuse2.0熟悉些了再配置)
4、下载并安装 Maven 2.0.6 。这个是必须的。有人问说不下载这个行不行?,我们build时用ant。在appfuse2.0中ant已经不推荐使用了,所以这个是必需的。如果你不喜欢用命令行的话,你也可以在eclipse创建自己的工程,你可以检出 Candy for AppFuse 。
下面我们就可以下载appfuse2.0了,选择你熟悉mvc,我下载的是Struts 2 Basic,
我在D:创建一个文件夹appfuse2-hzy,
例如D:/appfuse2-hzy/
在命令行中输入 mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic-struts -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0 -DgroupId=com.mycompany.app -DartifactId=myproject
这时maven就开始创建项目了,maven首先在C:/Documents and Settings/你的计算机用户名/.m2/repository下载appfuse2.0所需要的jar文件,这是一个漫长的等待过程。如果你的网速极快,你可以等下去。在appfuse.java.net网站中appfuse作者已经给我们准备好appfuse-2.0-rc1-dependencies.zip,你只要把它解压到C:/Documents and Settings/你的计算机用户名/.m2/repository目录里面maven检测到就不用下载了。
下面是各种配置类型maven所使用的命令:
配置类型 | 命 令 |
---|---|
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
Core (仅后端) |
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 |
要运行 AppFuse 现在已经很容易了,一旦建立了项目原型,Maven会用hibernate3和dbunit的插件创建和生成数据库。现在你要做的就是用 Maven 运行 Jetty,然后查看你的工程。
1、 在命令行下,cd 到你的工程目录下,运行 mvn ,这个命令会完成相关 jar 包和 Tomcat 的下载,运行你的工程的集成测试。上面的命令大概需要5-10分钟。
2、在你的工程目录下运行 mvn jetty:run-war ,你就可以去查看你的工程了。Maven 会启动 Jetty,这样的话,你就可以用这个地址: http://localhost:8080在你的浏览器中查看你的工程了。(如果你使用的是模块化原型,你需要在你的工程的 web 目录下运行 mvn jetty:run-war 。)你可以用 Eclipse, IDEA 或 NetBeans开发你的项目。 打算用Eclipse, 在dos中执行 mvn eclipse:eclipse 生成eclipse项目信息的文件. 用IDEA, 执行 mvn idea:idea.