148. Dependency Management

Spring Cloud GCP 物料清单(BOM)包含其使用的所有依赖项的版本。

如果您是 Maven 用户,则将以下内容添加到 pom.xml 文件中将使您可以不指定任何 Spring Cloud GCP 依赖版本。取而代之的是,您使用的 BOM 表的版本确定了所使用依赖项的版本。

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-gcp-dependencies</artifactId>
            <version>{project-version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

在以下各节中,将假定您使用的是 Spring Cloud GCP BOM,并且依赖项片段将不包含版本。

Gradle 用户可以使用 Spring 的dependency-management-plugin Gradle 插件获得相同的 BOM 体验。为简单起见,本文档其余部分中的 Gradle 依赖项摘要也将省略其版本。