maven groupId分组名称,artifactId项目名称,统一pom.xml设置
项目结构
1 <!-- 统一管理jar包版本 --> 2 <properties> 3 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 4 <maven.compiler.source>1.8</maven.compiler.source> 5 <maven.compiler.target>1.8</maven.compiler.target> 6 <junit.version>4.12</junit.version> 7 <log4j.version>1.2.17</log4j.version> 8 <lombok.version>1.16.18</lombok.version> 9 <mysql.version>5.1.47</mysql.version> 10 <druid.version>1.1.16</druid.version> 11 <mybatis.spring.boot.version>1.3.2</mybatis.spring.boot.version> 12 </properties> 13 14 <!-- 子模块继承之后,提供作用:锁定版本+子modlue不用写groupId和version --> 15 <dependencyManagement> 16 <dependencies> 17 <!--spring boot 2.2.2--> 18 <dependency> 19 <groupId>org.springframework.boot</groupId> 20 <artifactId>spring-boot-dependencies</artifactId> 21 <version>2.2.2.RELEASE</version> 22 <type>pom</type> 23 <scope>import</scope> 24 </dependency> 25 <!--spring cloud Hoxton.SR1--> 26 <dependency> 27 <groupId>org.springframework.cloud</groupId> 28 <artifactId>spring-cloud-dependencies</artifactId> 29 <version>Hoxton.SR1</version> 30 <type>pom</type> 31 <scope>import</scope> 32 </dependency> 33 <!--spring cloud alibaba 2.1.0.RELEASE--> 34 <dependency> 35 <groupId>com.alibaba.cloud</groupId> 36 <artifactId>spring-cloud-alibaba-dependencies</artifactId> 37 <version>2.1.0.RELEASE</version> 38 <type>pom</type> 39 <scope>import</scope> 40 </dependency> 41 <dependency> 42 <groupId>mysql</groupId> 43 <artifactId>mysql-connector-java</artifactId> 44 <version>${mysql.version}</version> 45 </dependency> 46 <dependency> 47 <groupId>com.alibaba</groupId> 48 <artifactId>druid-spring-boot-starter</artifactId> 49 <version>${druid.version}</version> 50 </dependency> 51 <dependency> 52 <groupId>org.mybatis.spring.boot</groupId> 53 <artifactId>mybatis-spring-boot-starter</artifactId> 54 <version>${mybatis.spring.boot.version}</version> 55 </dependency> 56 <dependency> 57 <groupId>junit</groupId> 58 <artifactId>junit</artifactId> 59 <version>${junit.version}</version> 60 </dependency> 61 <dependency> 62 <groupId>log4j</groupId> 63 <artifactId>log4j</artifactId> 64 <version>${log4j.version}</version> 65 </dependency> 66 <dependency> 67 <groupId>org.projectlombok</groupId> 68 <artifactId>lombok</artifactId> 69 <version>${lombok.version}</version> 70 <optional>true</optional> 71 </dependency> 72 </dependencies> 73 </dependencyManagement> 74 75 <build> 76 <plugins> 77 <plugin> 78 <groupId>org.springframework.boot</groupId> 79 <artifactId>spring-boot-maven-plugin</artifactId> 80 <configuration> 81 <fork>true</fork> 82 <addResources>true</addResources> 83 </configuration> 84 </plugin> 85 </plugins> 86 </build>