Commit 1fba24ff authored by Phillip Webb's avatar Phillip Webb

Generate rest documentation in compile phase

Update `spring-boot-actuator-docs` to generate rest documentation in
the compile phase.
parent 9a537070
......@@ -19,53 +19,98 @@
<main.basedir>${basedir}/..</main.basedir>
</properties>
<dependencies>
<!-- Compile -->
<!-- Provided -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<optional>true</optional>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<optional>true</optional>
<artifactId>spring-boot-actuator</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-hateoas</artifactId>
<optional>true</optional>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>provided</scope>
</dependency>
<!-- Test -->
<dependency>
<groupId>org.springframework.restdocs</groupId>
<artifactId>spring-restdocs</artifactId>
<version>1.0.0.M1</version>
<scope>test</scope>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-templates</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-groovy-templates</artifactId>
<scope>test</scope>
<groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.restdocs</groupId>
<artifactId>spring-restdocs</artifactId>
<version>1.0.0.M1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-restdoc-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/src/restdoc/java</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-restdoc-resource</id>
<phase>generate-sources</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>${basedir}/src/restdoc/resources</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testClassesDirectory>${project.build.outputDirectory}</testClassesDirectory>
<includes>
<include>**/*Documentation.java</include>
</includes>
<systemPropertyVariables>
<org.springframework.restdocs.outputDir>${project.build.directory}/generated-snippets</org.springframework.restdocs.outputDir>
</systemPropertyVariables>
<skipTests>false</skipTests>
</configuration>
<executions>
<execution>
<id>generate-rest-documentation</id>
<phase>process-classes</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.asciidoctor</groupId>
......@@ -111,5 +156,41 @@
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-surefire-plugin
</artifactId>
<versionRange>
[2.18.1,)
</versionRange>
<goals>
<goal>test</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
......@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.actuate.hypermedia.test;
package org.springframework.boot.actuate.hypermedia;
import groovy.text.Template;
import groovy.text.TemplateEngine;
......@@ -134,7 +134,7 @@ public class EndpointDocumentation {
PrintWriter writer = new PrintWriter(file, "UTF-8");
try {
Template template = this.templates.createTemplate(new File(
"src/test/resources/templates/endpoints.adoc.tpl"));
"src/restdoc/resources/templates/endpoints.adoc.tpl"));
template.make(model).writeTo(writer);
}
finally {
......
......@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.actuate.hypermedia.test;
package org.springframework.boot.actuate.hypermedia;
import groovy.text.TemplateEngine;
......
......@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.actuate.hypermedia.test;
package org.springframework.boot.actuate.hypermedia;
import groovy.text.TemplateEngine;
......
......@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.actuate.hypermedia.test;
package org.springframework.boot.actuate.hypermedia;
import groovy.text.GStringTemplateEngine;
import groovy.text.TemplateEngine;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment