Polish "Rename versionRange attribute to compatibilityRange"

See gh-968
This commit is contained in:
Stephane Nicoll 2019-08-09 11:34:02 +02:00
parent 71364408fa
commit 536e1830e7
4 changed files with 31 additions and 30 deletions

View File

@ -92,7 +92,7 @@ that dependency.
* A `scope` (can be `compile`, `runtime`, `provided` or `test`). * A `scope` (can be `compile`, `runtime`, `provided` or `test`).
* The reference to a `bom` or a `repository` that must be added to the project once * The reference to a `bom` or a `repository` that must be added to the project once
that dependency is added. that dependency is added.
* A `versionRange` used to determine the Spring Boot versions that are compatible * A `compatibilityRange` used to determine the platform versions that are compatible
with the dependency. with the dependency.
* Links to resources such as a guide or a reference doc section. * Links to resources such as a guide or a reference doc section.
@ -136,7 +136,7 @@ lines and further for some reason.
artifactId: foo-core artifactId: foo-core
bom: foo-bom bom: foo-bom
repository: foo-repo repository: foo-repo
versionRange: "[1.2.0.RELEASE,1.3.0.M1)" compatibilityRange: "[1.2.0.RELEASE,1.3.0.M1)"
---- ----
If one selects this entry, the `com.example.foo:foo-core}` dependency will be added If one selects this entry, the `com.example.foo:foo-core}` dependency will be added
@ -145,7 +145,7 @@ the project as well (see the "Env section" above for a reference to those
identifiers). Because the bom provides a dependency management for `foo-core` there identifiers). Because the bom provides a dependency management for `foo-core` there
is no need to hard code the version in the configuration. is no need to hard code the version in the configuration.
The `versionRange` syntax follows some simple rules: a square bracket "[" or "]" The `compatibilityRange` syntax follows some simple rules: a square bracket "[" or "]"
denotes an inclusive end of the range and a round bracket "(" or ")" denotes an denotes an inclusive end of the range and a round bracket "(" or ")" denotes an
exclusive end of the range. A range can also be unbounded by defining a a single exclusive end of the range. A range can also be unbounded by defining a a single
version. In the example above, the dependency will be available as from version. In the example above, the dependency will be available as from
@ -155,7 +155,7 @@ version. In the example above, the dependency will be available as from
### Dependency group ### Dependency group
A dependency group gather a set of dependencies as well as some common settings: A dependency group gather a set of dependencies as well as some common settings:
`bom`, `repository` and `versionRange`. If one of them is set, it is applied for all `bom`, `repository` and `compatibilityRange`. If one of them is set, it is applied for all
dependencies within that group. It is still possible to override a particular value dependencies within that group. It is still possible to override a particular value
at the dependency level. at the dependency level.

View File

@ -506,14 +506,15 @@ The rest of this section will detail the other configuration options.
[[dependencies-version-range]] [[dependencies-compatibility-range]]
==== Availability (version range) ==== Compatibility Range
By default, a dependency is available regardless of the Spring Boot version you have By default, a dependency is available regardless of the Spring Boot version you have
selected. If you need to restrict a dependency to a certain Spring Boot generation you selected. If you need to restrict a dependency to a certain Spring Boot generation you
can add a `versionRange` attribute to its definition. A version range is a range of can add a `compatibilityRange` attribute to its definition that defines a version range. A
versions of Spring Boot which are valid in combination with it. The versions are *not* version range is a range of versions of Spring Boot which are valid in combination with
applied to the dependency itself, but rather used to filter out the dependency, or modify it. The versions are *not* applied to the dependency itself, but rather used to filter out
it, when different versions of Spring Boot are selected for the generated project. the dependency, or modify it, when different versions of Spring Boot are selected for the
generated project.
A typical version is composed of four parts: a major revision, a minor revision, a patch A typical version is composed of four parts: a major revision, a minor revision, a patch
revision and a qualifier. Qualifiers are ordered as follows: revision and a qualifier. Qualifiers are ordered as follows:
@ -662,18 +663,18 @@ Here's an example of a BOM with mappings:
groupId: com.example.foo groupId: com.example.foo
artifactId: acme-foo-dependencies artifactId: acme-foo-dependencies
mappings: mappings:
- versionRange: "[1.2.3.RELEASE,1.3.0.RELEASE)" - compatibilityRange: "[1.2.3.RELEASE,1.3.0.RELEASE)"
groupId: com.example.bar groupId: com.example.bar
artifactId: acme-foo-bom artifactId: acme-foo-bom
version: Arcturus.SR6 version: Arcturus.SR6
- versionRange: "[1.3.0.RELEASE,1.4.0.RELEASE)" - compatibilityRange: "[1.3.0.RELEASE,1.4.0.RELEASE)"
version: Botein.SR7 version: Botein.SR7
- versionRange: "[1.4.0.RELEASE,1.5.x.RELEASE)" - compatibilityRange: "[1.4.0.RELEASE,1.5.x.RELEASE)"
version: Castor.SR6 version: Castor.SR6
- versionRange: "[1.5.0.RELEASE,1.5.x.BUILD-SNAPSHOT)" - compatibilityRange: "[1.5.0.RELEASE,1.5.x.BUILD-SNAPSHOT)"
version: Diadem.RC1 version: Diadem.RC1
repositories: spring-milestones repositories: spring-milestones
- versionRange: "1.5.x.BUILD-SNAPSHOT" - compatibilityRange: "1.5.x.BUILD-SNAPSHOT"
version: Diadem.BUILD-SNAPSHOT version: Diadem.BUILD-SNAPSHOT
repositories: spring-snapshots,spring-milestones repositories: spring-snapshots,spring-milestones
---- ----
@ -838,8 +839,8 @@ If your dependency requires a specific version of Spring Boot, ot different vers
Spring Boot require different versions of your dependency there are a couple of mechanisms Spring Boot require different versions of your dependency there are a couple of mechanisms
to configure that. to configure that.
The simplest is to put a `versionRange` in the dependency declaration. This is a range of The simplest is to put a `compatibilityRange` in the dependency declaration. This is a
versions of Spring Boot, not of your dependency. For example: range of versions of Spring Boot, not of your dependency. For example:
[source,yaml,indent=0] [source,yaml,indent=0]
---- ----
@ -850,11 +851,11 @@ versions of Spring Boot, not of your dependency. For example:
- name: Foo - name: Foo
id: foo id: foo
... ...
versionRange: 1.2.0.M1 compatibilityRange: 1.2.0.M1
- name: Bar - name: Bar
id: bar id: bar
... ...
versionRange: "[1.5.0.RC1,2.0.0.M1)" compatibilityRange: "[1.5.0.RC1,2.0.0.M1)"
---- ----
In this example `Foo` is available for Spring Boot 1.2.0 (or any milestone of 1.2.0) or In this example `Foo` is available for Spring Boot 1.2.0 (or any milestone of 1.2.0) or
@ -862,7 +863,7 @@ greater, and `Bar` is available for Spring Boot 1.5.0 up to, but not including 2
If different versions of your dependency work with different versions of Spring Boot, If different versions of your dependency work with different versions of Spring Boot,
that's when you need the `mappings` property. A mapping is a combination of a that's when you need the `mappings` property. A mapping is a combination of a
`versionRange` and some or all of the other properties of the dependency, overriding `compatibilityRange` and some or all of the other properties of the dependency, overriding
the values defined at the top level. For example: the values defined at the top level. For example:
[source,yaml,indent=0] [source,yaml,indent=0]
@ -875,12 +876,12 @@ the values defined at the top level. For example:
id: foo id: foo
groupId: org.acme.foo groupId: org.acme.foo
artifactId: foo-spring-boot-starter artifactId: foo-spring-boot-starter
versionRange: 1.3.0.RELEASE compatibilityRange: 1.3.0.RELEASE
bom: cloud-task-bom bom: cloud-task-bom
mappings: mappings:
- versionRange: "[1.3.0.RELEASE,1.3.x.RELEASE]" - compatibilityRange: "[1.3.0.RELEASE,1.3.x.RELEASE]"
artifactId: foo-starter artifactId: foo-starter
- versionRange: "1.4.0.RELEASE" - compatibilityRange: "1.4.0.RELEASE"
---- ----
In this example, The artifact of `foo` was changed to `foo-spring-boot-starter` as of the In this example, The artifact of `foo` was changed to `foo-spring-boot-starter` as of the
@ -899,10 +900,10 @@ A mapping can also be applied to a BOM declaration. For example:
artifactId: my-api-bom artifactId: my-api-bom
additionalBoms: ['my-api-dependencies-bom'] additionalBoms: ['my-api-dependencies-bom']
mappings: mappings:
- versionRange: "[1.0.0.RELEASE,1.1.6.RELEASE)" - compatibilityRange: "[1.0.0.RELEASE,1.1.6.RELEASE)"
version: 1.0.0.RELEASE version: 1.0.0.RELEASE
repositories: my-api-repo-1 repositories: my-api-repo-1
- versionRange: "1.2.1.RELEASE" - compatibilityRange: "1.2.1.RELEASE"
version: 2.0.0.RELEASE version: 2.0.0.RELEASE
repositories: my-api-repo-2 repositories: my-api-repo-2
---- ----
@ -971,7 +972,7 @@ Spring Boot starter is added as well.
A dependency group is a hint for user interface implementations, to group things together A dependency group is a hint for user interface implementations, to group things together
for users when they are selecting dependencies. It is also a convenient way to share for users when they are selecting dependencies. It is also a convenient way to share
settings between dependencies because every dependency inherits all the settings. The most settings between dependencies because every dependency inherits all the settings. The most
common settings in a group are the `groupId`, `versionRange` and `bom`: common settings in a group are the `groupId`, `compatibilityRange` and `bom`:
[source,yaml,indent=0] [source,yaml,indent=0]
---- ----
@ -979,7 +980,7 @@ common settings in a group are the `groupId`, `versionRange` and `bom`:
dependencies: dependencies:
- name: Stuff - name: Stuff
bom: stuff-bom bom: stuff-bom
versionRange: "[1.3.0.RELEASE,2.0.0.M1)" compatibilityRange: "[1.3.0.RELEASE,2.0.0.M1)"
content: content:
... ...
---- ----

View File

@ -29,8 +29,8 @@ import org.springframework.hateoas.UriTemplate;
/** /**
* A {@link InitializrMetadataJsonMapper} handling the metadata format for v2.1 * A {@link InitializrMetadataJsonMapper} handling the metadata format for v2.1
* <p> * <p>
* Version 2.1 brings the "versionRange" attribute for a dependency to restrict the Spring * Version 2.1 brings the "compatibilityRange" attribute for a dependency to restrict the
* Boot versions that can be used against it. That version also adds an additional * Spring Boot versions that can be used against it. That version also adds an additional
* `dependencies` endpoint. * `dependencies` endpoint.
* *
* @author Stephane Nicoll * @author Stephane Nicoll

View File

@ -31,7 +31,7 @@ public enum InitializrMetadataVersion {
V2("application/vnd.initializr.v2+json"), V2("application/vnd.initializr.v2+json"),
/** /**
* Add "versionRange" attribute to any dependency to specify which Spring Boot * Add "compatibilityRange" attribute to any dependency to specify which Spring Boot
* versions are compatible with it. Also provide a separate "dependencies" endpoint to * versions are compatible with it. Also provide a separate "dependencies" endpoint to
* query dependencies metadata. * query dependencies metadata.
*/ */