初步搭建
配置父项目
当Maven 执行一个带有子模块的项目的时候,Maven 首先载入父POM,然后定位所有的子模块POM。Maven 然后将所有这些项目的POM 放入到一个称为Maven 反应堆(Reactor)的东西中,由它负责分析模块之间的依赖关系。这个反应堆处理组件的排序,以确保相互独立的模块能以适当的顺序被编译和安装。
所以父项目只有一个pom.xml文件。
<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.shareprog</groupId>
<artifactId>shareprog-pom</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<name>shareprog</name>
<url>http://www.shareprog.com</url>
<description>常用的功能模块</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Hoxton.SR8</spring-cloud.version>
<spring-cloud-alibaba.version>2.2.3.RELEASE</spring-cloud-alibaba.version>
<spring-boot.version>2.3.4.RELEASE</spring-boot.version>
<!--mybatis-plus-->
<mybatis-plus-boot-starter.version>3.4.0</mybatis-plus-boot-starter.version>
<dynamic-datasource-spring-boot-starter.version>3.3.1</dynamic-datasource-spring-boot-starter.version>
<mybatis-plus-generator.vesion>3.4.0</mybatis-plus-generator.vesion>
<hutool-all.version>5.4.2</hutool-all.version>
<fastjson.version>1.2.73</fastjson.version>
<lombok.version>1.18.12</lombok.version>
<mysql.version>8.0.15</mysql.version>
<ojdbc.version>19.10.0.0</ojdbc.version>
<shareprog-common-core.version>1.0.0</shareprog-common-core.version>
<shareprog-common-feign.version>1.0.0</shareprog-common-feign.version>
<shareprog-common-redis.version>1.0.0</shareprog-common-redis.version>
<shareprog-common-datasource.version>1.0.0</shareprog-common-datasource.version>
</properties>
<dependencyManagement>
<dependencies>
<!-- SpringCloud 微服务 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- SpringCloud Alibaba 微服务 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>${spring-cloud-alibaba.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- SpringBoot 依赖配置 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!--mybatis-plus-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis-plus-boot-starter.version}</version>
</dependency>
<!--mybatis-plus多数据源配置-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>${dynamic-datasource-spring-boot-starter.version}</version>
</dependency>
<!-- mybatis-plus代码生成 -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>${mybatis-plus-generator.vesion}</version>
</dependency>
<!--hutool工具包-->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>${hutool-all.version}</version>
</dependency>
<!--alibab json包-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<!-- mysql driver -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<!-- 数据库驱动 -->
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc10</artifactId>
<version>${ojdbc.version}</version>
</dependency>
<dependency>
<groupId>com.shareprog</groupId>
<artifactId>shareprog-common-core</artifactId>
<version>${shareprog-common-core.version}</version>
</dependency>
<dependency>
<groupId>com.shareprog</groupId>
<artifactId>shareprog-common-feign</artifactId>
<version>${shareprog-common-feign.version}</version>
</dependency>
<dependency>
<groupId>com.shareprog</groupId>
<artifactId>shareprog-common-redis</artifactId>
<version>${shareprog-common-redis.version}</version>
</dependency>
<dependency>
<groupId>com.shareprog</groupId>
<artifactId>shareprog-common-datasource</artifactId>
<version>${shareprog-common-datasource.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
</build>
</project>