Document how to use org.asciidoctor.jvm.convert Gradle plugin

See gh-744
This commit is contained in:
Berchris Requiao
2021-08-23 21:04:41 +01:00
committed by Andy Wilkinson
parent 96293c0f17
commit 0952e5f974

View File

@@ -146,11 +146,15 @@ macro.
.Gradle
----
plugins { <1>
id "org.asciidoctor.convert" version "1.5.9.2"
id "org.asciidoctor.jvm.convert" version "3.3.2"
}
configurations {
asciidoctorExt
}
dependencies {
asciidoctor 'org.springframework.restdocs:spring-restdocs-asciidoctor:{project-version}' <2>
asciidoctorExt 'org.springframework.restdocs:spring-restdocs-asciidoctor:{project-version}' <2>
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc:{project-version}' <3>
}
@@ -163,25 +167,27 @@ macro.
}
asciidoctor { <6>
inputs.dir snippetsDir <7>
dependsOn test <8>
inputs.dir snippetsDir <7>
configurations 'asciidoctorExt' <8>
dependsOn test <9>
}
----
<1> Apply the Asciidoctor plugin.
<2> Add a dependency on `spring-restdocs-asciidoctor` in the `asciidoctor` configuration.
This will automatically configure the `snippets` attribute for use in your `.adoc` files
to point to `build/generated-snippets`. It will also allow you to use the `operation`
block macro.
<2> Add a dependency on `spring-restdocs-asciidoctor` in the `asciidoctorExt`
configuration. This will automatically configure the `snippets` attribute for use in your
`.adoc` files to point to `build/generated-snippets`. It will also allow you to use the
`operation` block macro.
<3> Add a dependency on `spring-restdocs-mockmvc` in the `testImplementation`
configuration. If you want to use `WebTestClient` or REST Assured rather than MockMvc,
add a dependency on `spring-restdocs-webtestclient` or `spring-restdocs-restassured`
respectively instead.
<4> Configure a property to define the output location for generated snippets.
<5> Configure the `test` task to add the snippets directory as an output.
<6> Configure the `asciidoctor` task
<6> Configure the `asciidoctor` task.
<7> Configure the snippets directory as an input.
<8> Make the task depend on the test task so that the tests are run before the
documentation is created.
<8> Add the configuration for the Asciidoctor external library extensions.
<9> Make the task depend on the test task so that the tests are run before the
documentation is created.
====
[[getting-started-build-configuration-packaging-the-documentation]]