springboot+idea+maven多模块项⽬搭建的详细过程(连接数据库进⾏测试)创建之前项⽬之前记得改⼀下 maven 提⾼下载Pom速度
记得 setting 中要改 maven 改成阿⾥云的。具体⽅法⽹上查第⼀步搭建parents 项⽬,为maven项⽬,不为springboot 项⽬记得修改groupId
第⼆步搭建多个⼦模块, honor-dao honor-manager honor-common记得创建 honor-manager 的时候要把他的gruopId 改成com.honor.manager
这⾥爆红的原因是因为我做到后⾯然后忘记截屏了,返回来做。实际我已经创建了,所以这个步骤是对的。按照这个做法,创建 honor-dao honor-manager honor-common,记得创建 honor-manager 的时候要把他的gruopId 改成com.honor.manager
第三步在 honor-manager 下分别创建 honor-manager-fc(maven) honor-manager-user(maven) honor-manager-boot (springboot,记得要使⽤springboot创建)创建时候有两个坑第⼀个是⽗级别选错。他⼀般会默认选第⼀级别,就是 honor 但是我们要继承的是 honor-manager第⼆个是路径别写错
第四步开始对各⼤ Pom 进⾏整合 dao 中⼀般需要引⼊ common ,common ⼀般不需要引其他模块,然后呢 manager 中要同时引⼊dao 和 common第⼀个是 honor ⽗级的 pom
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="/POM/4.0.0"
xmlns:xsi="/2001/XMLSchema-instance"
xsi:schemaLocation="/POM/4.0.0 /xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion>
<groupId>com.honor</groupId>
<artifactId>phone</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>honor-dao</module>
<module>honor-common</module>
<module>honor-manager</module>
</modules>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.7.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<honor-common>1.0-SNAPSHOT</honor-common>
<honor-dao>1.0-SNAPSHOT</honor-dao>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
&porting.outputEncoding>UTF-8</porting.outputEncoding>
<java.version>1.8</java.version>
<skipTests>true</skipTests>
<hutool.version>4.5.7</hutool.version>
<swagger2.version>2.7.0</swagger2.version>
<mybatis-generator.version>1.3.7</mybatis-generator.version>
<mybatis.version>3.4.6</mybatis.version>
<postgresql.version>42.2.12</postgresql.version>
<spring-data-commons.version>2.1.5.RELEASE</spring-data-commons.version>
<jjwt.version>0.9.0</jjwt.version>
<aliyun-oss.version>2.5.0</aliyun-oss.version>
<gson.version>2.8.5</gson.version>
<log4j2.version>2.13.3</log4j2.version>
<mybatis-plus.version>3.1.0</mybatis-plus.version>
<activiti.version>6.0.0</activiti.version>
<poi.version>4.1.2</poi.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions><!-- 去掉默认配置 -->
<!--<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>-->
<exclusion>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>-->
<!-- 移除Tomcat之后会报错,加⼊下⾯的依赖,使⽤外部容器 -->
<!--<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j2.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j2.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jul</artifactId>
<version>${log4j2.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j2.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.5.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.honor</groupId>
<artifactId>honor-common</artifactId>
<version>${honor-common}</version>
</dependency>
<dependency>
<groupId>com.honor</groupId>
<artifactId>honor-dao</artifactId>
<version>${honor-dao}</version>
</dependency>
<!--阿⾥巴巴连接池-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.20</version>
</dependency>
<!--Swagger-UI API⽂档⽣产⼯具-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger2.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger2.version}</version>
</dependency>
<!-- MyBatis-->
<!--<dependency>
<groupId&batis</groupId>
<artifactId>mybatis</artifactId>
<version>${mybatis.version}</version>
</dependency>-->
<!-- mybatis plus -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis-plus.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
springboot aop<version>${mybatis-plus.version}</version>
</dependency>
<!--mysql-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
<version>8.0.13</version>
</dependency>
<!--SpringData⼯具包-->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>${spring-data-commons.version}</version>
</dependency>
<!--JWT(Json Web Token)登录⽀持-->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>${jjwt.version}</version>
</dependency>
<!--Google的JSON解析⼯具-->
<dependency>
<groupId&le.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>
<!-- mvnrepository/artifact/net.sf.json-lib/json-lib -->
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
<!-- mvnrepository/artifact/org.activiti/activiti-engine --> <dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-engine</artifactId>
<version>${activiti.version}</version>
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论