spring-projects / spring-boot

Spring Boot helps you to create Spring-powered, production-grade applications and services with absolute minimum fuss.
https://spring.io/projects/spring-boot
Apache License 2.0
75.26k stars 40.71k forks source link

Use "target/generated-snippets" as default output directory for @AutoConfigureRestDocs #5997

Closed wimdeblauwe closed 8 years ago

wimdeblauwe commented 8 years ago

Would it not be easier to have target/generated-snippets as the default output directory on the @AutoConfigureRestDocs annotation instead of an empty string? Seems like the most sensible default.

wilkinsona commented 8 years ago

Thanks for the suggestion. Unfortunately it's not that simple as the directory is dependent on the build system that's being used: Maven uses target and Gradle uses build.

wimdeblauwe commented 8 years ago

Would it be possible to define a property? For example, if you put in application.properties:

spring.test.restdocs.outputDir=target/generated-snippets

That then this would be the default?

wilkinsona commented 8 years ago

I might be possible but I'd rather not do so as I don't think it'll be necessary when Boot upgrades to REST Docs 1.2.

REST Docs 1.2 automatically figures out what the output directory should be based on the build system you're using. It also comes with an Asciidoctor extension to automatically configure a snippets attribute that you can use when you include a snippet in your .adoc file. See http://docs.spring.io/spring-restdocs/docs/1.2.0.BUILD-SNAPSHOT/reference/html5/#getting-started-documentation-snippets-setup-junit and http://docs.spring.io/spring-restdocs/docs/1.2.0.BUILD-SNAPSHOT/reference/html5/#working-with-asciidoctor-including-snippets for more details.

wimdeblauwe commented 8 years ago

That is even better! Thanks.