父工程pom文件

43 阅读1分钟

接上一章《springboot 聚合框架》

1、修改pom文件

image.png 添加内容:

<packaging>pom</packaging>

2、删除工程的src

image.png

3、统一jar包版本管理

添加:dependencyManagement

```
<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>org.jiusi.cloud</groupId>
    <artifactId>jiusicloud-pdf</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>



    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <spring-boot.version>3.4.11</spring-boot.version>
    </properties>


    <!-- 子模块继承后,提供作用:锁定版本;modlue不用写groupId和version  -->
    <dependencyManagement>
        <dependencies>

            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>


        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <addResources>true</addResources>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
```