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 @@ ...@@ -19,53 +19,98 @@
<main.basedir>${basedir}/..</main.basedir> <main.basedir>${basedir}/..</main.basedir>
</properties> </properties>
<dependencies> <dependencies>
<!-- Compile --> <!-- Provided -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<optional>true</optional> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId> <artifactId>spring-boot-actuator</artifactId>
<optional>true</optional> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>junit</groupId>
<artifactId>spring-boot-starter-hateoas</artifactId> <artifactId>junit</artifactId>
<optional>true</optional> <scope>provided</scope>
</dependency> </dependency>
<!-- Test -->
<dependency> <dependency>
<groupId>org.springframework.restdocs</groupId> <groupId>org.codehaus.groovy</groupId>
<artifactId>spring-restdocs</artifactId> <artifactId>groovy-templates</artifactId>
<version>1.0.0.M1</version>
<scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-test</artifactId>
<scope>test</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.hateoas</groupId>
<artifactId>spring-boot-starter-groovy-templates</artifactId> <artifactId>spring-hateoas</artifactId>
<scope>test</scope> </dependency>
<dependency>
<groupId>org.springframework.restdocs</groupId>
<artifactId>spring-restdocs</artifactId>
<version>1.0.0.M1</version>
<scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <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> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration> <configuration>
<testClassesDirectory>${project.build.outputDirectory}</testClassesDirectory>
<includes> <includes>
<include>**/*Documentation.java</include> <include>**/*Documentation.java</include>
</includes> </includes>
<systemPropertyVariables> <systemPropertyVariables>
<org.springframework.restdocs.outputDir>${project.build.directory}/generated-snippets</org.springframework.restdocs.outputDir> <org.springframework.restdocs.outputDir>${project.build.directory}/generated-snippets</org.springframework.restdocs.outputDir>
</systemPropertyVariables> </systemPropertyVariables>
<skipTests>false</skipTests>
</configuration> </configuration>
<executions>
<execution>
<id>generate-rest-documentation</id>
<phase>process-classes</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.asciidoctor</groupId> <groupId>org.asciidoctor</groupId>
...@@ -111,5 +156,41 @@ ...@@ -111,5 +156,41 @@
</executions> </executions>
</plugin> </plugin>
</plugins> </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> </build>
</project> </project>
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.actuate.hypermedia.test; package org.springframework.boot.actuate.hypermedia;
import groovy.text.Template; import groovy.text.Template;
import groovy.text.TemplateEngine; import groovy.text.TemplateEngine;
...@@ -134,7 +134,7 @@ public class EndpointDocumentation { ...@@ -134,7 +134,7 @@ public class EndpointDocumentation {
PrintWriter writer = new PrintWriter(file, "UTF-8"); PrintWriter writer = new PrintWriter(file, "UTF-8");
try { try {
Template template = this.templates.createTemplate(new File( 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); template.make(model).writeTo(writer);
} }
finally { finally {
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.actuate.hypermedia.test; package org.springframework.boot.actuate.hypermedia;
import groovy.text.TemplateEngine; import groovy.text.TemplateEngine;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.actuate.hypermedia.test; package org.springframework.boot.actuate.hypermedia;
import groovy.text.TemplateEngine; import groovy.text.TemplateEngine;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.actuate.hypermedia.test; package org.springframework.boot.actuate.hypermedia;
import groovy.text.GStringTemplateEngine; import groovy.text.GStringTemplateEngine;
import groovy.text.TemplateEngine; 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