mirror of
https://gitee.com/dcren/initializr.git
synced 2025-04-05 17:38:06 +08:00
Polish "Rename versionRange attribute to compatibilityRange"
See gh-968
This commit is contained in:
parent
71364408fa
commit
536e1830e7
@ -92,7 +92,7 @@ that dependency.
|
||||
* 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
|
||||
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.
|
||||
* 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
|
||||
bom: foo-bom
|
||||
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
|
||||
@ -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
|
||||
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
|
||||
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
|
||||
@ -155,7 +155,7 @@ version. In the example above, the dependency will be available as from
|
||||
### Dependency group
|
||||
|
||||
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
|
||||
at the dependency level.
|
||||
|
||||
|
@ -506,14 +506,15 @@ The rest of this section will detail the other configuration options.
|
||||
|
||||
|
||||
|
||||
[[dependencies-version-range]]
|
||||
==== Availability (version range)
|
||||
[[dependencies-compatibility-range]]
|
||||
==== Compatibility Range
|
||||
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
|
||||
can add a `versionRange` attribute to its definition. A version range is a range of
|
||||
versions of Spring Boot which are valid in combination with it. The versions are *not*
|
||||
applied to the dependency itself, but rather used to filter out the dependency, or modify
|
||||
it, when different versions of Spring Boot are selected for the generated project.
|
||||
can add a `compatibilityRange` attribute to its definition that defines a version range. A
|
||||
version range is a range of versions of Spring Boot which are valid in combination with
|
||||
it. The versions are *not* applied to the dependency itself, but rather used to filter out
|
||||
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
|
||||
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
|
||||
artifactId: acme-foo-dependencies
|
||||
mappings:
|
||||
- versionRange: "[1.2.3.RELEASE,1.3.0.RELEASE)"
|
||||
- compatibilityRange: "[1.2.3.RELEASE,1.3.0.RELEASE)"
|
||||
groupId: com.example.bar
|
||||
artifactId: acme-foo-bom
|
||||
version: Arcturus.SR6
|
||||
- versionRange: "[1.3.0.RELEASE,1.4.0.RELEASE)"
|
||||
- compatibilityRange: "[1.3.0.RELEASE,1.4.0.RELEASE)"
|
||||
version: Botein.SR7
|
||||
- versionRange: "[1.4.0.RELEASE,1.5.x.RELEASE)"
|
||||
- compatibilityRange: "[1.4.0.RELEASE,1.5.x.RELEASE)"
|
||||
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
|
||||
repositories: spring-milestones
|
||||
- versionRange: "1.5.x.BUILD-SNAPSHOT"
|
||||
- compatibilityRange: "1.5.x.BUILD-SNAPSHOT"
|
||||
version: Diadem.BUILD-SNAPSHOT
|
||||
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
|
||||
to configure that.
|
||||
|
||||
The simplest is to put a `versionRange` in the dependency declaration. This is a range of
|
||||
versions of Spring Boot, not of your dependency. For example:
|
||||
The simplest is to put a `compatibilityRange` in the dependency declaration. This is a
|
||||
range of versions of Spring Boot, not of your dependency. For example:
|
||||
|
||||
[source,yaml,indent=0]
|
||||
----
|
||||
@ -850,11 +851,11 @@ versions of Spring Boot, not of your dependency. For example:
|
||||
- name: Foo
|
||||
id: foo
|
||||
...
|
||||
versionRange: 1.2.0.M1
|
||||
compatibilityRange: 1.2.0.M1
|
||||
- name: 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
|
||||
@ -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,
|
||||
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:
|
||||
|
||||
[source,yaml,indent=0]
|
||||
@ -875,12 +876,12 @@ the values defined at the top level. For example:
|
||||
id: foo
|
||||
groupId: org.acme.foo
|
||||
artifactId: foo-spring-boot-starter
|
||||
versionRange: 1.3.0.RELEASE
|
||||
compatibilityRange: 1.3.0.RELEASE
|
||||
bom: cloud-task-bom
|
||||
mappings:
|
||||
- versionRange: "[1.3.0.RELEASE,1.3.x.RELEASE]"
|
||||
- compatibilityRange: "[1.3.0.RELEASE,1.3.x.RELEASE]"
|
||||
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
|
||||
@ -899,10 +900,10 @@ A mapping can also be applied to a BOM declaration. For example:
|
||||
artifactId: my-api-bom
|
||||
additionalBoms: ['my-api-dependencies-bom']
|
||||
mappings:
|
||||
- versionRange: "[1.0.0.RELEASE,1.1.6.RELEASE)"
|
||||
- compatibilityRange: "[1.0.0.RELEASE,1.1.6.RELEASE)"
|
||||
version: 1.0.0.RELEASE
|
||||
repositories: my-api-repo-1
|
||||
- versionRange: "1.2.1.RELEASE"
|
||||
- compatibilityRange: "1.2.1.RELEASE"
|
||||
version: 2.0.0.RELEASE
|
||||
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
|
||||
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
|
||||
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]
|
||||
----
|
||||
@ -979,7 +980,7 @@ common settings in a group are the `groupId`, `versionRange` and `bom`:
|
||||
dependencies:
|
||||
- name: Stuff
|
||||
bom: stuff-bom
|
||||
versionRange: "[1.3.0.RELEASE,2.0.0.M1)"
|
||||
compatibilityRange: "[1.3.0.RELEASE,2.0.0.M1)"
|
||||
content:
|
||||
...
|
||||
----
|
||||
|
@ -29,8 +29,8 @@ import org.springframework.hateoas.UriTemplate;
|
||||
/**
|
||||
* A {@link InitializrMetadataJsonMapper} handling the metadata format for v2.1
|
||||
* <p>
|
||||
* Version 2.1 brings the "versionRange" attribute for a dependency to restrict the Spring
|
||||
* Boot versions that can be used against it. That version also adds an additional
|
||||
* Version 2.1 brings the "compatibilityRange" attribute for a dependency to restrict the
|
||||
* Spring Boot versions that can be used against it. That version also adds an additional
|
||||
* `dependencies` endpoint.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
|
@ -31,7 +31,7 @@ public enum InitializrMetadataVersion {
|
||||
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
|
||||
* query dependencies metadata.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user