maven管理ssi框架整合构建开发基本架构-来源实践高于实践工作中最近两年一直都是使用maven管理的struts2+s
maven管理ssi框架整合构建开发基本架构-来源实践高于实践
工作中最近两年一直都是使用maven管理的struts2+spring3+mybatis基本代码架构开发,总结工作中常用的东东,
自己搭建了一个框架。封装了一些基本的功能,只需要填业务代码就行了。
实现的封装功能为:
1、异常处理
2、struts2集成jsonResult
3、spring声明式事务处理
4、DAO基类实现基本的CRUD功能,其他的DAO类继承BaseDao,不需要写实现了,省了不少事。
5、分页组件封装
6、静态文件分离解决,比如静态文件放在CDN上
7、gbk编码时ajax乱码的解决
8、单元测试基类的封装
9、maven进行项目管理
同时基于这个框架写了一个例子集成maven jetty应用容器,使用内存数据库,可以直接运行例子代码。
如果系统安装好jdk和maven环境的话,双击项目根目录下run.bat可以使用jetty+hsqldb运行实例,在浏览器中http://localhost:8080/bigframe/home.htm。
代码托管在googlecode上。
trunk代码:https://bigframe.googlecode.com/svn/trunk/main
例子代码:https://bigframe.googlecode.com/svn/trunk/sample/bigframe-hsqldb
例子可以访问我的测试主页 http://do.jhost.cn/liu400liu/ ,测试主页的代码就是bigframe-hsqldb的代码部署的,使用内存数据库,服务重启数据就都没了。
后续打算基于这个框架写一个代码生成工具,可以改变字符编码,目前所有文件都是使用gbk编码的。
?

3 楼 it158 2011-10-27 你这个是用eclipse做的吗? 4 楼 liu400liu 2011-10-28 it158 写道你这个是用eclipse做的吗?
myeclipse开发的,方便。
eclipse也可以的不过要自己安装maven插件。
5 楼 Sunny_kaka 2011-11-24 run楼主的例子的时候出现一个问题,楼主帮忙看看.
我把例子代码check下来,运行run的时候maven提示错误了.
bigframe-webapp 1.0编译失败.
详细信息:
E:\workspace\bigframe-hsqldb\bigframe-biz>call mvn clean install
[INFO] Scanning for projects...
...省略...
[INFO]
[INFO] ------------------------------------
[INFO] Building bigframe-biz 1.0
[INFO] ------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ bigframe-biz ---
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ bigframe-biz ---
[INFO] Using 'gb18030' encoding to copy filtered resources.
[INFO] Copying 6 resources
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ bigframe-biz ---
[INFO] Compiling 13 source files to E:\workspace\bigframe-hsqldb\bigframe-biz\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ bigframe-biz ---
[INFO] Using 'gb18030' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ bigframe-biz ---
[INFO] Compiling 2 source files to E:\workspace\bigframe-hsqldb\bigframe-biz\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @ bigframe-biz ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ bigframe-biz ---
[INFO] Building jar: E:\workspace\bigframe-hsqldb\bigframe-biz\target\bigframe-biz-1.0.jar
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ bigframe-biz ---
[INFO] Installing E:\workspace\bigframe-hsqldb\bigframe-biz\target\bigframe-biz-1.0.jar to D:\apache-maven-3.0.3\repo\com\ldl\bigframe\bigframe-biz\1.0\bigframe-biz-1.0.jar
[INFO] Installing E:\workspace\bigframe-hsqldb\bigframe-biz\pom.xml to D:\apache-maven-3.0.3\repo\com\ldl\bigframe\bigframe-biz\1.0\bigframe-biz-1.0.pom
[INFO] ------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------
[INFO] Total time: 3.156s
[INFO] Finished at: Thu Nov 24 12:02:11 CST 2011
[INFO] Final Memory: 7M/14M
[INFO] ------------------------------------
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.ldl.bigframe:bigframe-webapp:war:1.0
[WARNING] 'artifactId' contains an expression but should be a constant. @ com.ldl.bigframe:${moduleWebapp}:1.0, E:\workspace\bigframe-hsqldb\bigframe-webapp\pom.xml, line 9, column 14
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-resources-plugin is missing. @ com.ldl.bigframe:bigframe:1.0, E:\workspace\bigframe-hsqldb\pom.xml, line 46, column 12
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ com.ldl.bigframe:bigframe:1.0, E:\workspace\bigframe-hsqldb\pom.xml, line 37, column 12
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ com.ldl.bigframe:bigframe:1.0, E:\workspace\bigframe-hsqldb\pom.xml, line 53, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------
[INFO] Building bigframe-webapp 1.0
[INFO] ------------------------------------
[INFO] ------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------
[INFO] Total time: 0.391s
[INFO] Finished at: Thu Nov 24 12:02:12 CST 2011
[INFO] Final Memory: 2M/5M
[INFO] ------------------------------------
[ERROR] Failed to execute goal on project bigframe-webapp: Could not resolve dependencies for project com.ldl.bigframe:bigframe-webapp:war:1.0: Failed to collect dependencies for [com.ldl.bigframe:big
frame-biz:jar:1.0 (compile), org.apache.struts:struts2-core:jar:2.2.3 (compile), org.apache.struts:struts2-spring-plugin:jar:2.2.3 (compile), javax.servlet:servlet-api:jar:2.5 (provided), org.apache.s
truts:struts2-json-plugin:jar:2.2.3 (compile)]: Failed to read artifact descriptor for com.ldl.bigframe:bigframe-biz:jar:1.0: Failure to find com.ldl.bigframe:bigframe:pom:1.0 in http://repo1.maven.or
g/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 6 楼 liu400liu 2011-11-24 Sunny_kaka 写道run楼主的例子的时候出现一个问题,楼主帮忙看看.
我把例子代码check下来,运行run的时候maven提示错误了.
bigframe-webapp 1.0编译失败.
详细信息:
E:\workspace\bigframe-hsqldb\bigframe-biz>call mvn clean install
[INFO] Scanning for projects...
...省略...
[INFO]
[INFO] ------------------------------------
[INFO] Building bigframe-biz 1.0
[INFO] ------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ bigframe-biz ---
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ bigframe-biz ---
[INFO] Using 'gb18030' encoding to copy filtered resources.
[INFO] Copying 6 resources
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ bigframe-biz ---
[INFO] Compiling 13 source files to E:\workspace\bigframe-hsqldb\bigframe-biz\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ bigframe-biz ---
[INFO] Using 'gb18030' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ bigframe-biz ---
[INFO] Compiling 2 source files to E:\workspace\bigframe-hsqldb\bigframe-biz\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @ bigframe-biz ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ bigframe-biz ---
[INFO] Building jar: E:\workspace\bigframe-hsqldb\bigframe-biz\target\bigframe-biz-1.0.jar
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ bigframe-biz ---
[INFO] Installing E:\workspace\bigframe-hsqldb\bigframe-biz\target\bigframe-biz-1.0.jar to D:\apache-maven-3.0.3\repo\com\ldl\bigframe\bigframe-biz\1.0\bigframe-biz-1.0.jar
[INFO] Installing E:\workspace\bigframe-hsqldb\bigframe-biz\pom.xml to D:\apache-maven-3.0.3\repo\com\ldl\bigframe\bigframe-biz\1.0\bigframe-biz-1.0.pom
[INFO] ------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------
[INFO] Total time: 3.156s
[INFO] Finished at: Thu Nov 24 12:02:11 CST 2011
[INFO] Final Memory: 7M/14M
[INFO] ------------------------------------
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.ldl.bigframe:bigframe-webapp:war:1.0
[WARNING] 'artifactId' contains an expression but should be a constant. @ com.ldl.bigframe:${moduleWebapp}:1.0, E:\workspace\bigframe-hsqldb\bigframe-webapp\pom.xml, line 9, column 14
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-resources-plugin is missing. @ com.ldl.bigframe:bigframe:1.0, E:\workspace\bigframe-hsqldb\pom.xml, line 46, column 12
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ com.ldl.bigframe:bigframe:1.0, E:\workspace\bigframe-hsqldb\pom.xml, line 37, column 12
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ com.ldl.bigframe:bigframe:1.0, E:\workspace\bigframe-hsqldb\pom.xml, line 53, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------
[INFO] Building bigframe-webapp 1.0
[INFO] ------------------------------------
[INFO] ------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------
[INFO] Total time: 0.391s
[INFO] Finished at: Thu Nov 24 12:02:12 CST 2011
[INFO] Final Memory: 2M/5M
[INFO] ------------------------------------
[ERROR] Failed to execute goal on project bigframe-webapp: Could not resolve dependencies for project com.ldl.bigframe:bigframe-webapp:war:1.0: Failed to collect dependencies for [com.ldl.bigframe:big
frame-biz:jar:1.0 (compile), org.apache.struts:struts2-core:jar:2.2.3 (compile), org.apache.struts:struts2-spring-plugin:jar:2.2.3 (compile), javax.servlet:servlet-api:jar:2.5 (provided), org.apache.s
truts:struts2-json-plugin:jar:2.2.3 (compile)]: Failed to read artifact descriptor for com.ldl.bigframe:bigframe-biz:jar:1.0: Failure to find com.ldl.bigframe:bigframe:pom:1.0 in http://repo1.maven.or
g/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] Failed to execute goal on project bigframe-webapp: Could not resolve dependencies for project com.ldl.bigframe:bigframe-webapp:war:1.0: Failed to collect dependencies for [com.ldl.bigframe:big
frame-biz:jar:1.0 (compile), org.apache.struts:struts2-core:jar:2.2.3 (compile), org.apache.struts:struts2-spring-plugin:jar:2.2.3 (compile), javax.servlet:servlet-api:jar:2.5 (provided), org.apache.s
truts:struts2-json-plugin:jar:2.2.3 (compile)]: Failed to read artifact descriptor for com.ldl.bigframe:bigframe-biz:jar:1.0: Failure to find com.ldl.bigframe:bigframe:pom:1.0 in http://repo1.maven.or
g/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
[ERROR]
jar包依赖有问题,确认你是联网了吗?需要下载一些依赖jar,在你本地的maven仓库里看需要的jar是否存在。