初探appfuse 2.0.1

首先下载安装marven,然后就可以使用marven来安装appfuse了。
我现在准备是基于struts2+spring+hibernate来构建项目。在命令提示符里进入某个文件夹,从AppFuse+QuickStart拷贝相应的命令(我选的是basic方式,还没实验module方式)

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

并做相应的修改,我准备作为第一个实践的项目是CMS,因为是第三次彻底的变更底层架构,所以我命名为cms3,包根路径为com.ynstudio.cms。即为

mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-struts -DremoteRepositories=http://static.appfuse.org/releases -DarchetypeVersion=2.0.1 -DgroupId=com.ynstudio.cms -DartifactId=cms3

但如果直接这样的话,有很多依赖的jar文件都会从网络上下载,这个速度是让人难以忍受的,可以先把appfuse-dependencies-2.0.1.zip下载下来,然后解压到某个文件夹下,然后修改$marven/conf/settings.xml里的相应配置,设置本地资源库。

  <!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ~/.m2/repository
  <localRepository>/path/to/local/repo</localRepository>
  -->
  <localRepository>E:/appfusedeps/repository</localRepository><!-- 我电脑上的设置 -->

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

    │  pom.xml
    │  README.txt
    │
    └─src
        ├─main
        │  ├─java
        │  │  └─com
        │  │      └─ynstudio
        │  │          └─cms
        │  │                  App.java
        │  │
        │  ├─resources
        │  │  │  applicationContext-resources.xml
        │  │  │  ApplicationResources.properties
        │  │  │  ApplicationResources_zh.properties
        │  │  │  ApplicationResources_zh_CN.properties
        │  │  │  ApplicationResources_zh_TW.properties
        │  │  │  default-data.xml
        │  │  │  ehcache.xml
        │  │  │  hibernate.cfg.xml
        │  │  │  jdbc.properties
        │  │  │  log4j.xml
        │  │  │  mail.properties
        │  │  │  sql-map-config.xml
        │  │  │  struts.xml
        │  │  │
        │  │  └─META-INF
        │  │          persistence.xml
        │  │
        │  └─webapp
        │      ├─common
        │      │      menu.jsp
        │      │
        │      └─WEB-INF
        │              applicationContext.xml
        │              menu-config.xml
        │              urlrewrite.xml
        │              web.xml
        │
        ├─site
        │      site.xml
        │
        └─test
            ├─java
            │  └─com
            │      └─ynstudio
            │          └─cms
            │                  AppTest.java
            │
            └─resources
                    config.xml
                    login.xml
                    sample-data.xml
                    web-tests.xml

然后修改pom.xml里mysql的密码,如果你接着运行mvn jetty:run-war,会产生需要的一切,并发布到jetty中,你就可以在浏览器里查看运行效果了。[[BR]] 我运行

mvn appfuse:full-source

则会创建数据库,生成相关的代码。代码文件夹结构如下

├─src
│  ├─main
│  │  ├─java
│  │  │  └─com
│  │  │      └─ynstudio
│  │  │          └─cms
│  │  │              ├─dao
│  │  │              │  ├─hibernate
│  │  │              │  └─spring
│  │  │              ├─model
│  │  │              ├─service
│  │  │              │  └─impl
│  │  │              ├─util
│  │  │              └─webapp
│  │  │                  ├─action
│  │  │                  ├─filter
│  │  │                  ├─interceptor
│  │  │                  ├─listener
│  │  │                  ├─taglib
│  │  │                  └─util
│  │  ├─resources
│  │  │  ├─com
│  │  │  │  └─ynstudio
│  │  │  │      └─cms
│  │  │  │          ├─model
│  │  │  │          └─webapp
│  │  │  │              └─action
│  │  │  └─META-INF
│  │  └─webapp
│  │      ├─admin
│  │      ├─common
│  │      ├─decorators
│  │      ├─images
│  │      ├─scripts
│  │      │  ├─calendar
│  │      │  │  └─lang
│  │      │  └─dojo
│  │      ├─styles
│  │      │  ├─andreas01
│  │      │  │  └─images
│  │      │  ├─calendar-aqua
│  │      │  ├─puzzlewithstyle
│  │      │  │  └─images
│  │      │  └─simplicity
│  │      │      └─images
│  │      ├─template
│  │      │  ├─css_xhtml
│  │      │  └─xhtml
│  │      └─WEB-INF
│  │          └─pages
│  │              └─admin
│  ├─site
│  └─test
│      ├─java
│      │  └─com
│      │      └─ynstudio
│      │          └─cms
│      │              ├─dao
│      │              │  └─hibernate
│      │              ├─service
│      │              │  └─impl
│      │              ├─util
│      │              └─webapp
│      │                  ├─action
│      │                  ├─filter
│      │                  └─listener
│      └─resources
│          ├─com
│          │  └─ynstudio
│          │      └─cms
│          │          └─service
│          │              └─impl
│          └─META-INF
└─target
    ├─appfuse-data
    ├─appfuse-data-common
    ├─appfuse-hibernate
    ├─appfuse-root
    ├─appfuse-service
    ├─appfuse-struts
    ├─appfuse-web
    └─appfuse-web-common

进一步的研究尚未进行,准备以此为依托来建立新的框架结构。因为我对appfuse尚未熟悉,计划的步骤是先在svn里随便建一个项目,然后待大致了解后再正式建立一个项目作为今后所有项目的基础架构。
转载请标明来源,谢谢 http://www.ynstudio.com

posted on 2007-12-01 15:57 一农 阅读(8371) 评论(6)  编辑  收藏

评论

# re: 初探appfuse2.0.1 2007-12-01 18:39 随缘

那个dependencies包下载太慢了,还总是出错,还不如用maven  回复  更多评论   

# re: 初探appfuse2.0.1 2007-12-01 22:01 一农

@随缘
hehe,我这边的网络情况下dependencies还满好的,特别用了迅雷。  回复  更多评论   

# re: 初探appfuse2.0.1 2007-12-03 16:20 Goodtiger

我也一直想用2.0.1来着呢
今天上午刚试了下  回复  更多评论   

# re: 初探appfuse 2.0.1 2008-01-16 16:56 xx

我在 src\main\webapp 随便加了一个1.jsp.
如何自动发布呢?就是网页能看到他。  回复  更多评论   

# re: 初探appfuse 2.0.1 2008-11-04 18:52 abao

国内的openjweb比这个好多了,不仅集成了很多开源框架,而且生成的页面有分页,查询,高级查询,排序,界面也好看,另外openjweb还可以生成树的功能,开发人员用几天时间写的树功能,用openjweb只需要一分钟,而且也可以自动编译,我不知道appfuse为什么这么知名,但很显然国内有太多的java快速开发平台已远远超过了appfuse,大家到网上找找openjweb技术白皮书比较一下就知道了  回复  更多评论   

# re: 初探appfuse 2.0.1 2008-11-04 21:42 一农

@abao

我想appfuse的出名可能是因为他只做很基础的内容,然后你可以自己扩展,也整出一个可以称为框架的自己的东西。而国内的一些快速开发平台可能太复杂,不适合学习了解内部机理。  回复  更多评论   


只有注册用户登录后才能发表评论。


网站导航:
 

公告

南京 java辅导班 约等于免费 详见yuqiaotech.com

导航

<2007年12月>
2526272829301
2345678
9101112131415
16171819202122
23242526272829
303112345

统计

常用链接

留言簿(10)

随笔档案

文章分类

文章档案

相册

搜索

最新评论

阅读排行榜

评论排行榜