一 工程介绍
该工程是一个基于Spring+SpringMVC+Mybatis的电商项目,项目采用多模块化来实现,具体实现如下图所示
多模块Maven项目搭建
二 创建工程步骤
1.首先创建一个普通的项目文件夹Mall
,里面存放该项目的所有工程
2.创建mall-parent
父类工程,后面所有的工程全部继承该工程
4.0.0
com.mall
mall-parent
1.0-SNAPSHOT
../mall-common
../mall-manager
../mall-web
pom
4.12
4.2.4.RELEASE
3.2.8
1.2.2
1.2.15
5.1.32
1.6.4
2.4.2
1.0.9
4.3.5
1.2
2.5
2.0
2.5
3.3.2
1.3.2
3.3
3.4.2
0.9.1
1.3.1
2.7.2
4.10.3
2.5.3
3.4.7
0.1
5.11.2
2.3.23
2.2.2
joda-time
joda-time
${joda-time.version}
org.apache.commons
commons-lang3
${commons-lang3.version}
org.apache.commons
commons-io
${commons-io.version}
commons-net
commons-net
${commons-net.version}
com.fasterxml.jackson.core
jackson-databind
${jackson.version}
org.apache.httpcomponents
httpclient
${httpclient.version}
org.quartz-scheduler
quartz
${quartz.version}
junit
junit
${junit.version}
test
org.slf4j
slf4j-log4j12
${slf4j.version}
org.mybatis
mybatis
${mybatis.version}
org.mybatis
mybatis-spring
${mybatis.spring.version}
com.github.miemiedev
mybatis-paginator
${mybatis.paginator.version}
com.github.pagehelper
pagehelper
${pagehelper.version}
mysql
mysql-connector-java
${mysql.version}
com.alibaba
druid
${druid.version}
org.springframework
spring-context
${spring.version}
org.springframework
spring-beans
${spring.version}
org.springframework
spring-webmvc
${spring.version}
org.springframework
spring-jdbc
${spring.version}
org.springframework
spring-aspects
${spring.version}
org.springframework
spring-jms
${spring.version}
org.springframework
spring-context-support
${spring.version}
jstl
jstl
${jstl.version}
javax.servlet
servlet-api
${servlet-api.version}
provided
javax.servlet
jsp-api
${jsp-api.version}
provided
commons-fileupload
commons-fileupload
${commons-fileupload.version}
redis.clients
jedis
${jedis.version}
org.apache.solr
solr-solrj
${solrj.version}
com.alibaba
dubbo
${dubbo.version}
org.apache.zookeeper
zookeeper
${zookeeper.version}
com.github.sgroschupf
zkclient
${zkclient.version}
org.apache.activemq
activemq-all
${activemq.version}
org.freemarker
freemarker
${freemarker.version}
${project.artifactId}
org.apache.maven.plugins
maven-resources-plugin
2.7
UTF-8
org.apache.maven.plugins
maven-compiler-plugin
3.7.0
1.8
UTF-8
org.apache.tomcat.maven
tomcat7-maven-plugin
2.2
3.创建mall-common
通用的工程, 打包方式jar
mall-parent
com.mall
1.0-SNAPSHOT
../mall-parent/pom.xml
4.0.0
mall-common
joda-time
joda-time
org.apache.commons
commons-lang3
org.apache.commons
commons-io
commons-net
commons-net
com.fasterxml.jackson.core
jackson-databind
org.apache.httpcomponents
httpclient
org.quartz-scheduler
quartz
junit
junit
test
org.slf4j
slf4j-log4j12
4.创建mall-manager
服务层工程、聚合工程、pom工程
mall-common
的过程不在演示
mall-parent
com.mall
1.0-SNAPSHOT
../mall-parent/pom.xml
4.0.0
mall-manager
pom
mall-manager-dao
mall-manager-entity
mall-manager-interface
mall-manager-service
mall-common
com.mall
1.0-SNAPSHOT
org.apache.tomcat.maven
tomcat7-maven-plugin
/
8091
5.创建mall-manager-dao
、
mall-manager
com.mall
1.0-SNAPSHOT
4.0.0
mall-manager-dao
mall-manager-entity
com.mall
1.0-SNAPSHOT
org.mybatis
mybatis
org.mybatis
mybatis-spring
com.github.miemiedev
mybatis-paginator
com.github.pagehelper
pagehelper
mysql
mysql-connector-java
com.alibaba
druid
mall-manager
com.mall
1.0-SNAPSHOT
4.0.0
mall-manager-entity
mall-manager
com.mall
1.0-SNAPSHOT
4.0.0
mall-manager-interface
mall-manager-entity
com.mall
1.0-SNAPSHOT
mall-manager
index.jsp
mall-manager
com.mall
1.0-SNAPSHOT
4.0.0
mall-manager-service
war
mall-manager-dao
com.mall
1.0-SNAPSHOT
org.springframework
spring-context
org.springframework
spring-beans
org.springframework
spring-webmvc
org.springframework
spring-jdbc
org.springframework
spring-aspects
org.springframework
spring-jms
org.springframework
spring-context-support
6.创建mall-web 表现层
创建项目
image.png
mall-parent
com.mall
1.0-SNAPSHOT
../mall-parent/pom.xml
4.0.0
mall-web
war
com.mall
mall-common
1.0-SNAPSHOT
com.mall
mall-manager-interface
1.0-SNAPSHOT
org.springframework
spring-context
org.springframework
spring-beans
org.springframework
spring-webmvc
org.springframework
spring-jdbc
org.springframework
spring-aspects
org.springframework
spring-jms
org.springframework
spring-context-support
jstl
jstl
javax.servlet
servlet-api
provided
javax.servlet
jsp-api
provided
com.alibaba
dubbo
spring
org.springframework
netty
org.jboss.netty
org.apache.zookeeper
zookeeper
com.github.sgroschupf
zkclient
org.apache.tomcat.maven
tomcat8-maven-plugin
/
8090
到此为止已经创建好了项目结构,创建的目录结构如下所示
目录结构
三 通过tomcat插件启动项目
org.apache.tomcat.maven
tomcat8-maven-plugin
/
8090