🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
**1. 在父工程下构建公共模块: cloud-api** ![](https://img.kancloud.cn/6a/12/6a1229901270e4eb564ae1cd6ada7038_1455x141.jpg) ![](https://img.kancloud.cn/2a/24/2a24be50d95876bfab1d27a1a4bd1412_1475x308.jpg) **2. 你会发现在当前模块的`pom.xml`中引入了父工程** ```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"> <parent> <!-- 1. 子模块引入父工程进行统一版本控制 --> <artifactId>rest-cloud-parent</artifactId> <groupId>org.atguigu.springcloud</groupId> <version>1.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cloud-api</artifactId> <properties> <java.version>1.8</java.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <lombok.verion>1.18.12</lombok.verion> </properties> <dependencies> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>${lombok.verion}</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.0</version> <configuration> <source>8</source> <target>8</target> </configuration> </plugin> </plugins> </build> </project> ``` **3. 你会在父工程的`pom.xml`中看到引入了当前的模块** ```xml <modules> <module>cloud-api</module> </modules> ``` **4. 在当前模块中创建一个Dept实体类** ```java @Data @NoArgsConstructor @AllArgsConstructor @Builder public class Dept implements Serializable { private Long deptno; private String dname; private String db_source; } ``` **5. 公共模块构建完毕!**