mirror of
https://gitee.com/dcren/initializr.git
synced 2025-09-18 09:44:47 +08:00
Polish
This commit is contained in:
@@ -101,15 +101,16 @@ list of the available configuration options.
|
|||||||
|
|
||||||
Here is the most basic dependency entry you could have
|
Here is the most basic dependency entry you could have
|
||||||
|
|
||||||
```yml
|
[source,yaml,indent=0]
|
||||||
initializr:
|
----
|
||||||
dependencies:
|
initializr:
|
||||||
- name: Core
|
dependencies:
|
||||||
content:
|
- name: Core
|
||||||
- id: security
|
content:
|
||||||
name: Security
|
- id: security
|
||||||
description: Secure your application via spring-security
|
name: Security
|
||||||
```
|
description: Secure your application via spring-security
|
||||||
|
----
|
||||||
|
|
||||||
TIP: The `security` dependency is held within a group called "Core".
|
TIP: The `security` dependency is held within a group called "Core".
|
||||||
|
|
||||||
@@ -122,20 +123,21 @@ Let's now add a custom dependency that is not managed by Spring Boot and that on
|
|||||||
work from Spring Boot `1.2.0.RELEASE` and onwards but should not be used in the 1.3
|
work from Spring Boot `1.2.0.RELEASE` and onwards but should not be used in the 1.3
|
||||||
lines and further for some reason.
|
lines and further for some reason.
|
||||||
|
|
||||||
```yml
|
[source,yaml,indent=0]
|
||||||
initializr:
|
----
|
||||||
dependencies:
|
initializr:
|
||||||
- name: Core
|
dependencies:
|
||||||
content:
|
- name: Core
|
||||||
- id: my-lib-id
|
content:
|
||||||
name: My lib
|
- id: my-lib-id
|
||||||
description: Secure your application via spring-security
|
name: My lib
|
||||||
groupId: com.example.foo
|
description: Secure your application via spring-security
|
||||||
artifactId: foo-core
|
groupId: com.example.foo
|
||||||
bom: foo-bom
|
artifactId: foo-core
|
||||||
repository: foo-repo
|
bom: foo-bom
|
||||||
versionRange: "[1.2.0.RELEASE,1.3.0.M1)"
|
repository: foo-repo
|
||||||
```
|
versionRange: "[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
|
||||||
and the Bill of Materials and repository for `foo` will be added automatically to
|
and the Bill of Materials and repository for `foo` will be added automatically to
|
||||||
@@ -166,13 +168,14 @@ support is meant to react to that.
|
|||||||
For instance, if you want your groupId to default to `org.acme` and the
|
For instance, if you want your groupId to default to `org.acme` and the
|
||||||
`javaVersions` to only be `1.8` and `11` you would write the following config:
|
`javaVersions` to only be `1.8` and `11` you would write the following config:
|
||||||
|
|
||||||
```yml
|
[source,yaml,indent=0]
|
||||||
initializr:
|
----
|
||||||
groupId:
|
initializr:
|
||||||
value: org.acme
|
groupId:
|
||||||
javaVersions:
|
value: org.acme
|
||||||
- id: 11
|
javaVersions:
|
||||||
default: false
|
- id: 11
|
||||||
- id: 1.8
|
default: false
|
||||||
default: true
|
- id: 1.8
|
||||||
```
|
default: true
|
||||||
|
----
|
||||||
|
@@ -347,27 +347,27 @@ declared at the top level (under `env`) and given an id via the key in the confi
|
|||||||
|
|
||||||
[source,yaml,indent=0]
|
[source,yaml,indent=0]
|
||||||
----
|
----
|
||||||
initializr:
|
initializr:
|
||||||
env:
|
env:
|
||||||
repositories:
|
repositories:
|
||||||
my-api-repo-1:
|
my-api-repo-1:
|
||||||
name: repo1
|
name: repo1
|
||||||
url: http://example.com/repo1
|
url: http://example.com/repo1
|
||||||
----
|
----
|
||||||
|
|
||||||
Once defined, the repository can then be referred back to in a dependency
|
Once defined, the repository can then be referred back to in a dependency
|
||||||
|
|
||||||
[source,yaml,indent=0]
|
[source,yaml,indent=0]
|
||||||
----
|
----
|
||||||
initializr:
|
initializr:
|
||||||
dependencies:
|
dependencies:
|
||||||
- name: Other
|
- name: Other
|
||||||
content:
|
content:
|
||||||
- name: Foo
|
- name: Foo
|
||||||
groupId: org.acme
|
groupId: org.acme
|
||||||
artifactId: foo
|
artifactId: foo
|
||||||
version: 1.3.5
|
version: 1.3.5
|
||||||
repository: my-api-repo-1
|
repository: my-api-repo-1
|
||||||
----
|
----
|
||||||
|
|
||||||
It is usually preferable to have a BOM for every dependency, and attach the repository to
|
It is usually preferable to have a BOM for every dependency, and attach the repository to
|
||||||
@@ -394,14 +394,14 @@ configuration key. Example:
|
|||||||
|
|
||||||
[source,yaml,indent=0]
|
[source,yaml,indent=0]
|
||||||
----
|
----
|
||||||
initializr:
|
initializr:
|
||||||
env:
|
env:
|
||||||
boms:
|
boms:
|
||||||
my-api-bom:
|
my-api-bom:
|
||||||
groupId: org.acme
|
groupId: org.acme
|
||||||
artifactId: my-api-dependencies
|
artifactId: my-api-dependencies
|
||||||
version: 1.0.0.RELEASE
|
version: 1.0.0.RELEASE
|
||||||
repositories: my-api-repo-1
|
repositories: my-api-repo-1
|
||||||
----
|
----
|
||||||
|
|
||||||
If a BOM requires a special, non-default repository, then it can be referred to here,
|
If a BOM requires a special, non-default repository, then it can be referred to here,
|
||||||
@@ -411,15 +411,15 @@ BOMs by referring to the id:
|
|||||||
|
|
||||||
[source,yaml,indent=0]
|
[source,yaml,indent=0]
|
||||||
----
|
----
|
||||||
initializr:
|
initializr:
|
||||||
dependencies:
|
dependencies:
|
||||||
- name: Other
|
- name: Other
|
||||||
content:
|
content:
|
||||||
- name: My API
|
- name: My API
|
||||||
id : my-api
|
id : my-api
|
||||||
groupId: org.acme
|
groupId: org.acme
|
||||||
artifactId: my-api
|
artifactId: my-api
|
||||||
bom: my-api-bom
|
bom: my-api-bom
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|
||||||
@@ -437,27 +437,27 @@ Here's an example of a BOM with mappings:
|
|||||||
|
|
||||||
[source,yaml,indent=0]
|
[source,yaml,indent=0]
|
||||||
----
|
----
|
||||||
initializr:
|
initializr:
|
||||||
env:
|
env:
|
||||||
boms:
|
boms:
|
||||||
cloud-bom:
|
cloud-bom:
|
||||||
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)"
|
- versionRange: "[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)"
|
- versionRange: "[1.3.0.RELEASE,1.4.0.RELEASE)"
|
||||||
version: Botein.SR7
|
version: Botein.SR7
|
||||||
- versionRange: "[1.4.0.RELEASE,1.5.x.RELEASE)"
|
- versionRange: "[1.4.0.RELEASE,1.5.x.RELEASE)"
|
||||||
version: Castor.SR6
|
version: Castor.SR6
|
||||||
- versionRange: "[1.5.0.RELEASE,1.5.x.BUILD-SNAPSHOT)"
|
- versionRange: "[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"
|
- versionRange: "1.5.x.BUILD-SNAPSHOT"
|
||||||
version: Diadem.BUILD-SNAPSHOT
|
version: Diadem.BUILD-SNAPSHOT
|
||||||
repositories: spring-snapshots,spring-milestones
|
repositories: spring-snapshots,spring-milestones
|
||||||
----
|
----
|
||||||
|
|
||||||
The primary use case here is to map Spring Boot versions to the preferred or supported
|
The primary use case here is to map Spring Boot versions to the preferred or supported
|
||||||
@@ -481,14 +481,14 @@ an alias can be defined for ths dependency;
|
|||||||
|
|
||||||
[source,yaml,indent=0]
|
[source,yaml,indent=0]
|
||||||
----
|
----
|
||||||
initializr:
|
initializr:
|
||||||
dependencies:
|
dependencies:
|
||||||
- name: Other
|
- name: Other
|
||||||
content:
|
content:
|
||||||
- name: Web Services
|
- name: Web Services
|
||||||
id: web-services
|
id: web-services
|
||||||
aliases:
|
aliases:
|
||||||
- ws
|
- ws
|
||||||
----
|
----
|
||||||
|
|
||||||
The same project can now be generated with `dependencies=ws` or
|
The same project can now be generated with `dependencies=ws` or
|
||||||
@@ -626,18 +626,18 @@ versions of Spring Boot, not of your dependency. For example:
|
|||||||
|
|
||||||
[source,yaml,indent=0]
|
[source,yaml,indent=0]
|
||||||
----
|
----
|
||||||
initializr:
|
initializr:
|
||||||
dependencies:
|
dependencies:
|
||||||
- name: Stuff
|
- name: Stuff
|
||||||
content:
|
content:
|
||||||
- name: Foo
|
- name: Foo
|
||||||
id: foo
|
id: foo
|
||||||
...
|
...
|
||||||
versionRange: 1.2.0.M1
|
versionRange: 1.2.0.M1
|
||||||
- name: Bar
|
- name: Bar
|
||||||
id: bar
|
id: bar
|
||||||
...
|
...
|
||||||
versionRange: "[1.5.0.RC1,2.0.0.M1)"
|
versionRange: "[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
|
||||||
@@ -650,20 +650,20 @@ the values defined at the top level. For example:
|
|||||||
|
|
||||||
[source,yaml,indent=0]
|
[source,yaml,indent=0]
|
||||||
----
|
----
|
||||||
initializr:
|
initializr:
|
||||||
dependencies:
|
dependencies:
|
||||||
- name: Stuff
|
- name: Stuff
|
||||||
content:
|
content:
|
||||||
- name: Foo
|
- name: Foo
|
||||||
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
|
versionRange: 1.3.0.RELEASE
|
||||||
bom: cloud-task-bom
|
bom: cloud-task-bom
|
||||||
mappings:
|
mappings:
|
||||||
- versionRange: "[1.3.0.RELEASE,1.3.x.RELEASE]"
|
- versionRange: "[1.3.0.RELEASE,1.3.x.RELEASE]"
|
||||||
artifactId: foo-starter
|
artifactId: foo-starter
|
||||||
- versionRange: "1.4.0.RELEASE"
|
- versionRange: "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
|
||||||
@@ -674,20 +674,20 @@ A mapping can also be applied to a BOM declaration. For example:
|
|||||||
|
|
||||||
[source,yaml,indent=0]
|
[source,yaml,indent=0]
|
||||||
----
|
----
|
||||||
initializr:
|
initializr:
|
||||||
env:
|
env:
|
||||||
boms:
|
boms:
|
||||||
my-api-bom:
|
my-api-bom:
|
||||||
groupId: org.acme
|
groupId: org.acme
|
||||||
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)"
|
- versionRange: "[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"
|
- versionRange: "1.2.1.RELEASE"
|
||||||
version: 2.0.0.RELEASE
|
version: 2.0.0.RELEASE
|
||||||
repositories: my-api-repo-2
|
repositories: my-api-repo-2
|
||||||
----
|
----
|
||||||
|
|
||||||
In this example Spring Boot versions up to 1.1.6 select version 1.0.0 of the BOM, and set
|
In this example Spring Boot versions up to 1.1.6 select version 1.0.0 of the BOM, and set
|
||||||
@@ -713,15 +713,15 @@ existing Spring Boot starter) you can flag it as a "non starter":
|
|||||||
|
|
||||||
[source,yaml,indent=0]
|
[source,yaml,indent=0]
|
||||||
----
|
----
|
||||||
initializr:
|
initializr:
|
||||||
dependencies:
|
dependencies:
|
||||||
- name: Stuff
|
- name: Stuff
|
||||||
content:
|
content:
|
||||||
- name: Lib
|
- name: Lib
|
||||||
id: lib
|
id: lib
|
||||||
groupId: com.acme
|
groupId: com.acme
|
||||||
artifactId: lib
|
artifactId: lib
|
||||||
starter:false
|
starter:false
|
||||||
----
|
----
|
||||||
|
|
||||||
When a project is generated that only has dependencies with this flag set, then the base
|
When a project is generated that only has dependencies with this flag set, then the base
|
||||||
@@ -738,13 +738,13 @@ common settings in a group are the `groupId`, `versionRange` and `bom`:
|
|||||||
|
|
||||||
[source,yaml,indent=0]
|
[source,yaml,indent=0]
|
||||||
----
|
----
|
||||||
initializr:
|
initializr:
|
||||||
dependencies:
|
dependencies:
|
||||||
- name: Stuff
|
- name: Stuff
|
||||||
bom: stuff-bom
|
bom: stuff-bom
|
||||||
versionRange: "[1.3.0.RELEASE,2.0.0.M1)"
|
versionRange: "[1.3.0.RELEASE,2.0.0.M1)"
|
||||||
content:
|
content:
|
||||||
...
|
...
|
||||||
----
|
----
|
||||||
|
|
||||||
These dependencies, by default, will be available only for Spring Boot versions 1.3 up to
|
These dependencies, by default, will be available only for Spring Boot versions 1.3 up to
|
||||||
|
Reference in New Issue
Block a user