如果 springboot 的 parent依赖 不能用

  • 如果 parent 不能用 springboot 的 stater 该怎么办呢

    <?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <!-- 正常 parent  -- >
            <!--    <parent>-->
            <!--        <groupId>org.springframework.boot</groupId>-->
            <!--        <artifactId>spring-boot-starter-parent</artifactId>-->
            <!--        <version>2.2.0.RELEASE</version>-->
            <!--        <relativePath/> &lt;!&ndash; lookup parent from repository &ndash;&gt;-->
            <!--    </parent>-->
        <groupId>com.example</groupId>
        <artifactId>spring-home</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <name>spring-home</name>
        <description>Demo project for Spring Boot</description>
    
        <properties>
            <java.version>1.8</java.version>
        </properties>
    
            <!--   如果不导入 parent,则利用该依赖管理  -->
        <dependencyManagement>
            <dependencies>
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-dependencies</artifactId>
                    <version>2.2.0.RELEASE</version>
                    <type>pom</type>
                    <scope>import</scope>
                </dependency>
            </dependencies>
        </dependencyManagement>
    
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter</artifactId>
            </dependency>
        </dependencies>
    
        <build>
            <plugins>
            <!--        正常打包    -->
            <!--            <plugin>-->
            <!--                <groupId>org.springframework.boot</groupId>-->
            <!--                <artifactId>spring-boot-maven-plugin</artifactId>-->
            <!--            </plugin>-->
    
            <!-- 自定义打包 -->
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <version>2.2.0.RELEASE</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>repackage</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    
    </project>
    
12-30 18:37