问题
I am working on Spring cloud contract documentation and I have seen a comment in dependency from Spring cloud documentation and would like to know what exactly is this <!-- If you're adding this dependency explicitly you have to
add it *BEFORE* the Release Train BOM-->
回答1:
Please read the docs: https://projects.spring.io/spring-cloud/ . If you go to Quick Start
you'll see
The release train label (see below) is actually only used explicitly in one artifact: "spring-cloud-dependencies" (all the others have normal numeric release labels tied to their parent project). The depednencies POM is the one you can use as a BOM for dependency management. Example using the latest version with the config client and eureka (change the artifact ids to pull in other starters):
回答2:
A BOM is the acronym for Bill of Materials: for your features, you need other projects, each of them with different versions. With a bom you get a list of compatible/tested/needed versions of such projects, all in one place.
As explained in spring-data, a release train is a BOM with a name instead of a version (to avoid confusions) and the names are ordered alphabetically.
If you want to override one of the versions written in the release train, you have to put that explicit dependency before the release train itself. So in the doc you linked, it is saying, if you want to use the version 2.0.0.RC2 of the artifact spring-cloud-contract-dependencies, put it (for example) before:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Finchley.RC1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
because the Finchley.RC1 includes a different version of that dependency (in this case 2.0.0.RC1).
来源:https://stackoverflow.com/questions/48708153/what-is-release-train-bom