1、
设置MAVEN环境变量:
MAVEN_HOME=D:\shebeiguanli\apache-maven-3.2.5
PATH=%MAVEN_HOME%\bin
2、
修改D:\shebeiguanli\maven-2.0.7\conf\settings.xml,
将<localRepository>/shebeiguanli/.m2/repository</localRepository>修改为实际的目录
3、
新建目录test,创建项目
cd E:\appfuse\test
mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-tapestry-archetype -DarchetypeVersion=2.1.0-M1 -DgroupId=com.mycompany -DartifactId=myproject
mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-spring-archetype -DarchetypeVersion=3.0.0 -DgroupId=com.cx.bi -DartifactId=dm -DarchetypeRepository=https://oss.sonatype.org/content/repositories/appfuse
4、安装mysql,启动mysql,用户名默认root,密码默认为空,若要修改则修改pom.xml
5、引入全部源代码
mvn appfuse:full-source
6、生成eclipse项目
mvn eclipse:eclipse
7、
编译打包war部署
mvn package -DskipTests
mvn jetty:run-war
删除.classpath里的
<classpathentry kind="var" path="M2_REPO/org/springframework/spring/2.0.3/spring-2.0.3.jar"/>
eclipse的项目属性,project facets,convert to facets form,选择dynamic web project
访问http://localhost:8080
用户admin/admin
8、
解压部署
mvn war:inplace
mvn jetty:run
9、修改pom.xml的native2ascii-utf8插件配置
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>ApplicationResources_el*.properties</exclude>
<exclude>ApplicationResources_zh*.properties</exclude>
<exclude>ApplicationResources_ko*.properties</exclude>
<exclude>displaytag_el*.properties</exclude>
<exclude>displaytag_zh*.properties</exclude>
</excludes>
10、代码生成
mvn appfuse:gen-model
//提示要输入表名,t_zcxx。结果是生成一个源代码类
mvn appfuse:gen -Dentity=Name
//Name就是上一步生成的类名,TZcxx。结果是生成一套源代码类,在界面访问
指定表名生成代码:
修改pom.xml:
<configuration>
<!-- Fix annotation detection issue for Java 7. Thanks Shred! -->
<!-- http://www.shredzone.de/cilla/page/352/hibernate3-maven-plugin-fails-with-java-17.html -->
<componentProperties>
<implementation>annotationconfiguration</implementation>
<revengfile>src/test/resources/hibernate.reveng.ftl</revengfile>
</componentProperties>
<genericCore>${amp.genericCore}</genericCore>
<fullSource>${amp.fullSource}</fullSource>
</configuration>
参考资料:
http://appfuse.org/display/APF/AppFuse+QuickStart
http://appfuse.org/display/APF/Tutorials