maven多模块ssm+freemarker搭建总结.doc_第1页
maven多模块ssm+freemarker搭建总结.doc_第2页
maven多模块ssm+freemarker搭建总结.doc_第3页
maven多模块ssm+freemarker搭建总结.doc_第4页
maven多模块ssm+freemarker搭建总结.doc_第5页
已阅读5页,还剩41页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Ssm+maven+freemarker搭建1. 用maven创建多模块项目1.整个项目的结构|- handsome|-handsome-biz|-handsome-biz-dao数据库层|-handsome-biz-manager业务层|-handsome-web|-handsome-web-deploy页面模板|-handsome-web-home控制层|-handsome-web-war用来运行,打包2.首先创建一个maven项目修改pom.xml文件 4.0.0 com.handsome handsome 0.0.1-SNAPSHOT pom父项目必须为pom任何一个Maven项目都需要定义POM元素packaging(如果不写则默认值为jar)。顾名思义,该元素决定了项目的打包方式。实际的情形中,如果你不声明该元素,Maven会帮你生成一个JAR包;如果你定义该元素的值为war,那你会得到一个WAR包;如果定义其值为POM(比如是一个父模块),那什么包都不会生成 handsome UTF-8 junit junit 3.8.1 test 接下来创建的都是该项目的模块:我理解的模块是分级的.在本项目中分为两级 handsome-biz 和handsome-web 是一级. 其他为二级模块3.创建一级模块handsome-biz 和handsome-web在handsome项目上新建模块完成后在handsome中pom.xml文件中可以看到,两个子模块修改两个一级模块的pom.xml文件的package 为 pom 准备创建二级模块将红框中不需要的删除, 新增packaing标签4.创建二级模块在handsome-biz 和 handsome-web下创建 二级模块创建方法和上面一样.不在复述.5.删除一些不要的目录和依赖父项目不要依赖. 吧dependencies标签干掉 左侧 maven dependencies 目录就没有了.Handsome 删成这样其他两个一级模块也删到这样简洁.6. 添加模块之间的依赖关系在handsome-biz-manager中添加对 handsome-biz-dao的依赖在handsome-web-core中添加对handsome-biz-manager的依赖在handsome-web-war中添加对handsome-web-core的依赖最终项目就变成了这样:2. ssm整合1.将war项目转换成web项目这样项目就可以添加到tomcat了部署的少了依赖包 2.增加maven依赖到部署3.修改整理pom文件Handsome pom.xml UTF-8 4.0.6.RELEASE 3.2.7 5.1.29 2.3.20 4.0.0 com.handsome handsome 0.1 pom handsome handsome-biz handsome-web Handsome-biz pom.xml UTF-8 4.0.6.RELEASE 3.2.7 5.1.29 2.3.20 4.0.0 com.handsome handsome 0.1 pom handsome handsome-biz handsome-web Handsome-biz-dao pom.xml 4.0.0 com.handsome handsome-biz 0.1 handsome-biz-dao handsome-biz-dao junit junit 4.11 test org.mybatis mybatis $mybatis.version org.mybatis mybatis-spring 1.2.2 mysql mysql-connector-java $mysql.version commons-dbcp commons-dbcp 1.4 commons-pool commons-pool 1.6 handsome-biz-manager pom.xml 4.0.0 com.handsome handsome-biz 0.1 handsome-biz-dao handsome-biz-dao junit junit 4.11 test org.mybatis mybatis $mybatis.version org.mybatis mybatis-spring 1.2.2 mysql mysql-connector-java $mysql.version commons-dbcp commons-dbcp 1.4 commons-pool commons-pool 1.6 handsome-web pom.xml 4.0.0 com.handsome handsome-biz 0.1 handsome-biz-dao handsome-biz-dao junit junit 4.11 test org.mybatis mybatis $mybatis.version org.mybatis mybatis-spring 1.2.2 mysql mysql-connector-java $mysql.version commons-dbcp commons-dbcp 1.4 commons-pool commons-pool 1.6 Handsome-web-core pom.xml 4.0.0 com.handsome handsome-web 0.1 handsome-web-core handsome-web-core com.handsome handsome-biz-manager $project.version org.freemarker freemarker $freemarker.version handsome-web-deploy pom.xml 4.0.0 com.handsome handsome-web 0.1 handsome-web-deploy handsome-web-deploy pomhandsome-web-war pom.xml 4.0.0 com.handsome handsome-web 0.1 handsome-web-war handsome-web-war war com.handsome handsome-web-core $project.version 4. 编译项目在上选择 maven install如果有错, 整项目部署目录和web.xml文件完成后可以看到tomcat中的变化依赖包出现了.5.整合思路6. 写一个简单功能代码写一个简单功能代码. 从dao到 manager(service) 到controllerDao层 新建userdao,userdoManager层Controller层 也就是handsome-web-core模块Handsome-web-deploy 上面详细的列出了项目结构和具体代码7.具体配置Web.xmlspringmvcorg.springframework.web.servlet.DispatcherServletcontextConfigLocationclasspath:spring/spring-mvc.xml1springmvc/ index.jsp Handsome-web-war中Cperties#freemarker的配置#handsome.freemarker.templates=E:/eclipse_workspace/ssm_workspace/handsome/handsome-web/handsome-web-deploy/templates#log4j的配置#

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论