Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to use REST Docs with the new org.asciidoctor.jvm.convert Gradle plugin #744

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions docs/src/docs/asciidoc/getting-started.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,15 @@ the configuration are described in the following listings:
.Gradle
----
plugins { <1>
id "org.asciidoctor.convert" version "1.5.9.2"
id "org.asciidoctor.jvm.convert" version "3.3.2"
}

configurations {
asciidoctorExt
brneto marked this conversation as resolved.
Show resolved Hide resolved
}

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>
}

Expand All @@ -163,25 +167,27 @@ the configuration are described in the following listings:
}

asciidoctor { <6>
inputs.dir snippetsDir <7>
brneto marked this conversation as resolved.
Show resolved Hide resolved
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.
<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.
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.
brneto marked this conversation as resolved.
Show resolved Hide resolved
<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]]
Expand Down