配色: 字号:
maven创建SSM项目
2016-10-18 | 阅:  转:  |  分享 
  
Eclipse创建maven项目创建父类yinghuameng-parent项目修改pom.xml文件tp://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/200
1/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org
/POM/4.0.0http://maven.apache.org/xsd/maven-4.0.0.xsd">rsion>4.0.0com.yinghuamengtifactId>yinghuameng-parent0.0.1-SNAPSHOT<
/version>pom
4.12>4.1.3.RELEASE3
.2.8
1.2.2ng.version>1.2.15ersion>5.1.321.6.4<
/slf4j.version>2.4.2sion>1.0.94.3.5ersion>1.22.5servlet-api.version>2.0ime.version>2.53.3.2commons-lang3.version>1.3.2on>3.3ion>3.4.2-fix0.9.1parser.version>1.3.1oad.version>2.7.24.
10.3
2.3.23n>2.2.2
anagement>joda-
time
joda-time${joda-t
ime.version}
>org.apache.commonscommons-lang3artifactId>${commons-lang3.version}y>org.apache.commonsco
mmons-io
${commons-io.version}pendency>commons-netco
mmons-net
${commons-net.version}dependency>com.fas
terxml.jackson.core
jackson-databindctId>${jackson.version}
org.apache.httpcomponents
httpclient${httpclient.version}
junitroupId>junit${junit.version}ersion>test<
groupId>org.slf4jslf4j-log4j12
${slf4j.version}
<
dependency>org.mybatismybatisifactId>${mybatis.version}
ency>org.mybatismybatis-spring
tifactId>${mybatis.spring.version}>com.github.miemiedevm
ybatis-paginator
${mybatis.paginator.version
}
com.github.pagehelpe
r
pagehelper${pagehelp
er.version}
pId>mysqlmysql-connector-java<
version>${mysql.version}
dency>com.alibabadruid>${druid.version}<
dependency>org.springframeworkspri
ng-context
${spring.version}ndency>org.springframeworktId>spring-beans
${spring.version}
org.springframeworkrtifactId>spring-webmvc${spring.version}ersion>org.springframeworkupId>spring-jdbc${spring.versio
n}
org.springframework
spring-aspects${sprin
g.version}
org.springf
ramework
spring-context-support
${spring.version}
ependency>jstljstlrsion>${jstl.version}
javax.servlet
servlet-apion>${servlet-api.version}provided
dency>javax.servletjsp
-api
${jsp-api.version}prov
ided
comm
ons-fileupload
commons-fileuploadd>${commons-fileupload.version}
--Redis客户端-->redis.clientsactId>jedis${jedis.version}ndency>org.apache.solrpId>solr-solrj${solrj.version}<
/version>
org.freemarkerd>freemarker${freemarker.versio
n}
org.quartz-schedule
r
quartz${quartz.versi
on}
<
build>${project.artifactId}org.apache.maven.pluginstifactId>maven-resources-plugin2.7>UTF-8n>org.apache.maven.pluginsupId>maven-compiler-plugin3.2version>1.71.7ncoding>UTF-8nManagement>org.apac
he.tomcat.maven
tomcat7-maven-pluginctId>2.2

创建工具类yinghuameng-common项目修改pom.xml文件lns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.
org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apa
che.org/POM/4.0.0http://maven.apache.org/xsd/maven-4.0.0.xsd"><
modelVersion>4.0.0yinghuamen
g-parent
com.yinghuameng>0.0.1-SNAPSHOT
com.yinghuamengupId>yinghuameng-common0.0.1-
SNAPSHOT
joda-tim
e
joda-time
org.apache.commonsifactId>commons-lang3Id>org.apache.commons
commons-io>
commons-netId>commons-net
junitjunittest
org.slf4j<
/groupId>slf4j-log4j12
ject>创建yinghuameng-manager项目修改pom.xml文件en.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSch
ema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0
.0http://maven.apache.org/xsd/maven-4.0.0.xsd">4.
0.0
yinghuameng-parentactId>com.yinghuameng0.0.1-SNAPSHOT
com.yinghuamengId>yinghuameng-manager0.0.1-SNAPSHOTion>pom-添加工具类的依赖-->com.yinghuameng<
artifactId>yinghuameng-common0.0.1-SNAPSHO
T
创建模块项目yinghuam
eng-manager-pojo项目创建模块项目yinghuameng-manager-dao项目修改pom.xml文件ectxmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://w
ww.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://mav
en.apache.org/POM/4.0.0http://maven.apache.org/xsd/maven-4.0.0.x
sd">4.0.0ying
huameng-manager
com.yinghuameng<
version>0.0.1-SNAPSHOT
..
yinghuameng-manager-daoorg.mybat
is
mybatis
ncy>org.mybatismybatis-springifactId>com.github.miemiedevroupId>mybatis-paginatorpendency>com.github.pagehelperpage
helper
d>mysqlmysql-connector-javaependency>com.alibaba<
artifactId>druid
ndencyManagement>创建模块项目yinghuameng-manager-service项目修改p
om.xml文件创建模块项目yinghuameng-manager-web项目修改pom.xml文件"http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/
2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.
org/POM/4.0.0http://maven.apache.org/xsd/maven-4.0.0.xsd">lVersion>4.0.0yinghuameng-ma
nager
com.yinghuameng0.
0.1-SNAPSHOT
..

yinghuameng-manager-webwarpackaging>>yinghuameng-manager-servicecom.yinghuamen
g
0.0.1-SNAPSHOT
jstljstlifactId>javax.servlet
servlet-apiprovidedndency>javax.servletjs
p-api
provided
commons-fileupload
commons-fileupload
ject>添加web.xml文件lns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns="http://
java.sun.com/xml/ns/javaee"xmlns:web="http://java.sun.com/xml/ns
/javaee/web-app_2_5.xsd"xsi:schemaLocation="http://java.sun.com/x
ml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"id
="yinghuameng"version="2.5">yinghuameng-managerisplay-name>index.htmlfile>index.htmindex.js
p
default.html-file>default.htm
default.jspe-file>
在聚合项目yinghuameng-manager中添加t
omcat插件lugin>org.apache.tomcat.maventomca
t7-maven-plugin
8080>/
创建访问页面index
.jsp<%@pagelanguage="java"contentType="text/html;charset=UTF-
8"pageEncoding="UTF-8"%>4.01Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">ml>set=UTF-8">访问页面

樱花梦商城欢迎页面

dy>运行工程使用命令tomcat7:run步骤:yinghuameng-manager–>右击->runas-
>Mavenbuild报错及解决方案错误一:yinghuameng-parent项目未找到步骤:yinghuameng-par
ent–>右击->runas->install错误二yinghuameng-common项目未找到步骤:yinghuameng
-common–>右击->runas->install运行整合SSM框架添加配置文件包SqlMapConfig.xmlversion="1.0"encoding="UTF-8"?>-//mybatis.org//DTDConfig3.0//EN""http://mybatis.org/dtd/mybati
s-3-config.dtd">applicationContext
-dao.xml//www.springframework.org/schema/beans"xmlns:context="http://www.
springframework.org/schema/context"xmlns:p="http://www.springfra
mework.org/schema/p"xmlns:aop="http://www.springframework.org/sch
ema/aop"xmlns:tx="http://www.springframework.org/schema/tx"xmlns
:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocatio
n="http://www.springframework.org/schema/beanshttp://www.springf
ramework.org/schema/beans/spring-beans-4.0.xsdhttp://www.springfr
amework.org/schema/contexthttp://www.springframework.org/schema/
context/spring-context-4.0.xsdhttp://www.springframework.org/sche
ma/aophttp://www.springframework.org/schema/aop/spring-aop-4.0.x
sdhttp://www.springframework.org/schema/txhttp://www.springfram
ework.org/schema/tx/spring-tx-4.0.xsdhttp://www.springframework.o
rg/schema/utilhttp://www.springframework.org/schema/util/spring-
util-4.0.xsd">ceholderlocation="classpath:properties/.properties"/>taSource"destroy-method="close">c.url}"/>ropertyname="password"value="${jdbc.password}"/>="driverClassName"value="${jdbc.driver}"/>tive"value="10"/>--让spring管理sqlsessionfactory使用mybatis和spring整合包中的-->sqlSessionFactory"class="org.mybatis.spring.SqlSessionFactoryBea
n">
lasspath:mybatis/SqlMapConfig.xml"/>eanclass="org.mybatis.spring.mapper.MapperScannerConfigurer">opertyname="basePackage"value="com.yinghuameng.mapper"/>>db.propertiesjdbc.driver=com.mysql.jdbc.Driverjdbc.url=j
dbc:mysql://localhost:3306/taotao?characterEncoding=utf-8jdbc.use
rname=rootjdbc.password=rootapplicationContext-service.xmlersion="1.0"encoding="UTF-8"?>mework.org/schema/beans"xmlns:context="http://www.springframework
.org/schema/context"xmlns:p="http://www.springframework.org/sche
ma/p"xmlns:aop="http://www.springframework.org/schema/aop"xmlns:
tx="http://www.springframework.org/schema/tx"xmlns:xsi="http://ww
w.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.s
pringframework.org/schema/beanshttp://www.springframework.org/sc
hema/beans/spring-beans-4.0.xsdhttp://www.springframework.org/sch
ema/contexthttp://www.springframework.org/schema/context/spring-
context-4.0.xsdhttp://www.springframework.org/schema/aophttp://w
ww.springframework.org/schema/aop/spring-aop-4.0.xsdhttp://www.s
pringframework.org/schema/txhttp://www.springframework.org/schem
a/tx/spring-tx-4.0.xsdhttp://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-4.0.xsd"><
!--包扫描器,扫描带@Service注解的类-->"com.yinghuameng.service">applic
ationContext-trans.xmlsxmlns="http://www.springframework.org/schema/beans"xmlns:contex
t="http://www.springframework.org/schema/context"xmlns:p="http:/
/www.springframework.org/schema/p"xmlns:aop="http://www.springfra
mework.org/schema/aop"xmlns:tx="http://www.springframework.org/s
chema/tx"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi
:schemaLocation="http://www.springframework.org/schema/beanshttp
://www.springframework.org/schema/beans/spring-beans-4.0.xsdhttp:
//www.springframework.org/schema/contexthttp://www.springframewo
rk.org/schema/context/spring-context-4.0.xsdhttp://www.springfram
ework.org/schema/aophttp://www.springframework.org/schema/aop/sp
ring-aop-4.0.xsdhttp://www.springframework.org/schema/txhttp://
www.springframework.org/schema/tx/spring-tx-4.0.xsdhttp://www.spr
ingframework.org/schema/utilhttp://www.springframework.org/schem
a/util/spring-util-4.0.xsd">nager"class="org.springframework.jdbc.datasource.DataSourceTransa
ctionManager">urce"/>nager="transactionManager">name="save"propagation="REQUIRED"/>propagation="REQUIRED"/>IRED"/>thodname="delete"propagation="REQUIRED"/>ate"propagation="REQUIRED"/>n="SUPPORTS"read-only="true"/>tion="SUPPORTS"read-only="true"/>tion="SUPPORTS"read-only="true"/>--切面-->execution(com.yinghuameng.service..(..))"/>ans>springmvc.xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http:/
/www.w3.org/2001/XMLSchema-instance"xmlns:p="http://www.springfr
amework.org/schema/p"xmlns:context="http://www.springframework.or
g/schema/context"xmlns:mvc="http://www.springframework.org/schema
/mvc"xsi:schemaLocation="http://www.springframework.org/schema/be
anshttp://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvchttp://www.springframew
ork.org/schema/mvc/spring-mvc-4.0.xsdhttp://www.springframework.
org/schema/contexthttp://www.springframework.org/schema/context/
spring-context.xsd">se-package="com.yinghuameng.controller">
ss="org.springframework.web.servlet.view.InternalResourceViewReso
lver">ame="suffix"value=".jsp"/>Web.xml"1.0"encoding="UTF-8"?>1/XMLSchema-instance"xmlns="http://java.sun.com/xml/ns/javaee"xm
lns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"xsi:sc
hemaLocation="http://java.sun.com/xml/ns/javaeehttp://java.sun.c
om/xml/ns/javaee/web-app_2_5.xsd"id="yinghuameng"version="2.5"><
display-name>yinghuameng-manager
>index.htmlindex.htmindex.jspdefault.htmldefault.htmdefault.jspcontextConfigLocationclasspath:spring/applicationContext-.xmlorg.springframework.web.context.ContextLoaderListenerCharacterEncodingFilterorg.springframework.web.filter.CharacterEncodingFilterencodingutf-8CharacterEncodingFilter/yinghuameng-managerorg.springframework.web.servlet.DispatcherServletcontextConfigLocationclasspath:spring/springmvc.xml1yinghuameng-manager/
献花(0)
+1
(本文系樱梦雪苹宝首藏)