diff --git a/README.md b/README.md
index fc0c797b..ac61f8a6 100644
--- a/README.md
+++ b/README.md
@@ -117,6 +117,21 @@ asciidoctor {
```
+You may want to include the generated documentation in your project's jar file, for
+example to have it [served as static content by Spring Boot][12]. You can do so by
+configuring the `jar` task to depend on the `asciidoctor` task and to copy the
+generated documentation into the jar's `static` directory:
+
+```groovy
+jar {
+ dependsOn asciidoctor
+ from ("${asciidoctor.outputDir}/html5") {
+ into 'static/docs'
+ }
+}
+
+```
+
#### Maven configuration
You can look at either samples' `pom.xml` file to see the required configuration. The key
@@ -176,7 +191,48 @@ access to the generated snippets:
+```
+You may want to include the generated documentation in your project's jar file, for
+example to have it [served as static content by Spring Boot][12]. You can do so by
+changing the configuration of the Asciidoctor plugin so that it runs in the
+`prepare-package` phase and then configuring Maven's resources plugin to copy the
+generated documentation into a location where it'll be included in the project's jar:
+
+```xml
+
+ org.asciidoctor
+ asciidoctor-maven-plugin
+ 1.5.2
+
+
+ generate-docs
+ prepare-package
+
+
+
+
+
+ maven-resources-plugin
+ 2.7
+
+
+ copy-resources
+ prepare-package
+
+ copy-resources
+
+
+ ${project.build.outputDirectory}/static/docs
+
+
+ ${project.build.directory}/generated-docs
+
+
+
+
+
+
```
### Programatically generated snippets
@@ -282,3 +338,4 @@ To learn more, take a look at the accompanying sample projects:
[9]: https://speakerdeck.com/ankinson/documenting-restful-apis
[10]: https://build.spring.io/plugins/servlet/buildStatusImage/SRD-PUB (Build status)
[11]: https://build.spring.io/browse/SRD-PUB
+[12]: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-spring-mvc-static-content
diff --git a/rest-notes-spring-data-rest/build.gradle b/rest-notes-spring-data-rest/build.gradle
index 49da8bd0..fa6262c9 100644
--- a/rest-notes-spring-data-rest/build.gradle
+++ b/rest-notes-spring-data-rest/build.gradle
@@ -51,6 +51,13 @@ asciidoctor {
dependsOn test
}
+jar {
+ dependsOn asciidoctor
+ from ("${asciidoctor.outputDir}/html5") {
+ into 'static/docs'
+ }
+}
+
task wrapper(type: Wrapper) {
gradleVersion = '2.1'
}
diff --git a/rest-notes-spring-data-rest/pom.xml b/rest-notes-spring-data-rest/pom.xml
index ad2f3c2a..37b10e6b 100644
--- a/rest-notes-spring-data-rest/pom.xml
+++ b/rest-notes-spring-data-rest/pom.xml
@@ -79,7 +79,7 @@
generate-docs
- package
+ prepare-package
process-asciidoc
@@ -93,6 +93,27 @@
+
+ maven-resources-plugin
+ 2.7
+
+
+ copy-resources
+ prepare-package
+
+ copy-resources
+
+
+ ${project.build.outputDirectory}/static/docs
+
+
+ ${project.build.directory}/generated-docs
+
+
+
+
+
+
diff --git a/rest-notes-spring-hateoas/build.gradle b/rest-notes-spring-hateoas/build.gradle
index 0f21290b..fff6d0e1 100644
--- a/rest-notes-spring-hateoas/build.gradle
+++ b/rest-notes-spring-hateoas/build.gradle
@@ -53,6 +53,13 @@ asciidoctor {
dependsOn test
}
+jar {
+ dependsOn asciidoctor
+ from ("${asciidoctor.outputDir}/html5") {
+ into 'static/docs'
+ }
+}
+
task wrapper(type: Wrapper) {
gradleVersion = '2.1'
}
diff --git a/rest-notes-spring-hateoas/pom.xml b/rest-notes-spring-hateoas/pom.xml
index 881626d5..1193a258 100644
--- a/rest-notes-spring-hateoas/pom.xml
+++ b/rest-notes-spring-hateoas/pom.xml
@@ -95,7 +95,7 @@
generate-docs
- package
+ prepare-package
process-asciidoc
@@ -109,6 +109,27 @@
+
+ maven-resources-plugin
+ 2.7
+
+
+ copy-resources
+ prepare-package
+
+ copy-resources
+
+
+ ${project.build.outputDirectory}/static/docs
+
+
+ ${project.build.directory}/generated-docs
+
+
+
+
+
+