Polish "Add Kotlin DSL examples to Gradle Plugin's documentation"

Closes gh-14585
This commit is contained in:
Andy Wilkinson
2018-10-05 10:40:45 +01:00
parent 5ed6c0d1ab
commit a3d2f3f594
11 changed files with 131 additions and 136 deletions

View File

@@ -19,29 +19,18 @@ include::../gradle/getting-started/apply-plugin-release.gradle.kts[]
----
endif::[]
ifeval::["{version-type}" == "MILESTONE"]
The plugin is published to the Spring milestones repository.
For Gradle versions less than 4.10, you must apply the plugin imperatively:
The plugin is published to the Spring milestones repository. For Gradle versions less
than 4.10, this means that you must apply the plugin imperatively:
[source,groovy,indent=0,subs="verbatim,attributes"]
----
include::../gradle/getting-started/apply-plugin-milestone.gradle[]
----
For Gradle 4.10 and above, it can be applied using the `plugins` block:
[source,groovy,indent=0,subs="verbatim,attributes",role="primary"]
.Groovy
----
include::../gradle/getting-started/apply-plugin-release.gradle[]
----
[source,kotlin,indent=0,subs="verbatim,attributes",role="secondary"]
.Kotlin
----
include::../gradle/getting-started/apply-plugin-release.gradle.kts[]
----
provided you add the following lines in the `settings.gradle` file (or `settings.gradle.kts` in Kotlin):
For Gradle 4.10 and above, Gradle can be configured to use the milestones repository
and it can be applied using the `plugins` block. To configure Gradle to use the milestones
repository, add the following to your `settings.gradle` (Groovy) or `settings.gradle.kts`
(Kotlin):
[source,groovy,indent=0,subs="verbatim,attributes",role="primary"]
.Groovy
@@ -54,18 +43,9 @@ include::../gradle/getting-started/milestone-settings.gradle[]
----
include::../gradle/getting-started/milestone-settings.gradle.kts[]
----
endif::[]
ifeval::["{version-type}" == "SNAPSHOT"]
The plugin is published to the Spring snapshots repository.
For Gradle versions less than 4.10, you must apply the plugin imperatively:
The plugin can then be applied using the `plugins` block:
[source,groovy,indent=0,subs="verbatim,attributes"]
----
include::../gradle/getting-started/apply-plugin-snapshot.gradle[]
----
For Gradle 4.10 and above, it can be applied using the `plugins` block:
[source,groovy,indent=0,subs="verbatim,attributes",role="primary"]
.Groovy
----
@@ -77,8 +57,20 @@ include::../gradle/getting-started/apply-plugin-release.gradle[]
----
include::../gradle/getting-started/apply-plugin-release.gradle.kts[]
----
endif::[]
ifeval::["{version-type}" == "SNAPSHOT"]
The plugin is published to the Spring snapshots repository. For Gradle versions less
than 4.10, this means that you must apply the plugin imperatively:
provided you add the following lines in the `settings.gradle` file (or `settings.gradle.kts` in Kotlin):
[source,groovy,indent=0,subs="verbatim,attributes"]
----
include::../gradle/getting-started/apply-plugin-milestone.gradle[]
----
For Gradle 4.10 and above, Gradle can be configured to use the snapshots repository
and it can be applied using the `plugins` block. To configure Gradle to use the snapshots
repository, add the following to your `settings.gradle` (Groovy) or `settings.gradle.kts`
(Kotlin):
[source,groovy,indent=0,subs="verbatim,attributes",role="primary"]
.Groovy
@@ -91,6 +83,20 @@ include::../gradle/getting-started/snapshot-settings.gradle[]
----
include::../gradle/getting-started/snapshot-settings.gradle.kts[]
----
The plugin can then be applied using the `plugins` block:
[source,groovy,indent=0,subs="verbatim,attributes",role="primary"]
.Groovy
----
include::../gradle/getting-started/apply-plugin-release.gradle[]
----
[source,kotlin,indent=0,subs="verbatim,attributes",role="secondary"]
.Kotlin
----
include::../gradle/getting-started/apply-plugin-release.gradle.kts[]
----
endif::[]
Applied in isolation the plugin makes few changes to a project. Instead, the plugin

View File

@@ -121,13 +121,12 @@ include::../gradle/managing-dependencies/configure-bom.gradle.kts[tags=configure
----
The Kotlin code above is a bit awkward. That's because we're using the imperative way of applying
the dependency management plugin.
The Kotlin code above is a bit awkward. That's because we're using the imperative way of
applying the dependency management plugin.
We can make the code less awkward by applying the plugin from
the root parent project, or by using the `plugins` block as we're doing for the spring boot plugin.
The downside of this method, though, is that it forces us to specify the version of the
dependency management plugin, even though it's a dependency of the spring boot plugin:
We can make the code less awkward by applying the plugin from the root parent project, or
by using the `plugins` block as we're doing for the Spring Boot plugin. A downside of this
method is that it forces us to specify the version of the dependency management plugin:
[source,kotlin,indent=0,subs="verbatim,attributes"]
----