用IDEA搭建多模块框架
搭建步骤:
1.创建父工程
选择需要的依赖点击完成
2.然后依次在父工程下创建子模块 findlove-common,findlove-dao,findlove-service,findlove-web
3.最重要的是父工程及子模块的pom.xml文件的配置,很容易导致问题的出现,在这里遇到很多坑
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="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.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sunko.findlove</groupId>
<artifactId>findlove</artifactId>
<packaging>pom</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>findlove</name>
<description>Demo project for Spring Boot</description>
<modules>
<module>findlove-service</module>
<module>findlove-dao</module>
<module>findlove-web</module>
<module>findlove-common</module>
</modules>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<findlove.version>0.0.1-SNAPSHOT</findlove.version>
<mybatis.version>2.0.0</mybatis.version>
<lombok.version>1.18.6</lombok.version>
<mysql.version>8.0.15</mysql.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<version>2.1.4.RELEASE</version>
</dependency>
<!--集成Mybatis-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>${mybatis.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
<!--<scope>runtime</scope>-->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!--<dependency>-->
<!--<groupId>org.springframework.boot</groupId>-->
<