为什么缺少 spring-boot-build 父依赖项?
Why spring-boot-build parent dependency is missig?
我知道当我从 spring-boot-starter-parent
继承时,我将拥有这个继承链:
我的项目 => spring-boot-starter-parent => spring-boot-dependencies => spring-boot-build => maven 父 pom
=>(表示继承)
的确,这就是我在 Github 中看到的。我相信这是真的。
但是当我在 IDE (IntelliJ) 上浏览这些 POM 时,spring-boot-dependencies
没有声明父 pom(根据 [=41= 应该是 spring-boot-build
])
为什么我的IDE中spring-boot-dependencies
没有指定继承(有GitHub)?我错过了什么?
编辑
我项目的 pom:
<?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>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
它没有在你的 IDE 中显示父 POM 关系,因为在部署到中央 Maven 存储库的 spring-boot-dependencies 的 pom 文件中,没有父 POM标签:https://search.maven.org/artifact/org.springframework.boot/spring-boot-dependencies/2.2.0.RELEASE/pom
Eclipse 将加载该 pom 文件,而不是源存储库中的文件。
所以看起来 Spring Boot 的构建过程在将 pom 部署到 Maven Central 时删除了父标记。
原因可能是(从命名上看),spring-boot-build 仅提供与 Spring Boot 本身的构建过程相关的配置和依赖项,但不是对于使用它的应用程序来说是必需的或需要的。
我知道当我从 spring-boot-starter-parent
继承时,我将拥有这个继承链:
我的项目 => spring-boot-starter-parent => spring-boot-dependencies => spring-boot-build => maven 父 pom
=>(表示继承)
的确,这就是我在 Github 中看到的。我相信这是真的。
但是当我在 IDE (IntelliJ) 上浏览这些 POM 时,spring-boot-dependencies
没有声明父 pom(根据 [=41= 应该是 spring-boot-build
])
为什么我的IDE中spring-boot-dependencies
没有指定继承(有GitHub)?我错过了什么?
编辑
我项目的 pom:
<?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>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
它没有在你的 IDE 中显示父 POM 关系,因为在部署到中央 Maven 存储库的 spring-boot-dependencies 的 pom 文件中,没有父 POM标签:https://search.maven.org/artifact/org.springframework.boot/spring-boot-dependencies/2.2.0.RELEASE/pom Eclipse 将加载该 pom 文件,而不是源存储库中的文件。
所以看起来 Spring Boot 的构建过程在将 pom 部署到 Maven Central 时删除了父标记。
原因可能是(从命名上看),spring-boot-build 仅提供与 Spring Boot 本身的构建过程相关的配置和依赖项,但不是对于使用它的应用程序来说是必需的或需要的。