This commit splits Spring REST Docs into two projects – spring-restdocs-core and spring-restdocs-mockmvc. spring-restdocs-core contains the vast majority of the code but does not depend on a specific test framework other than JUnit. The use of a Spring Test TestExecutionListener has been replaced with a JUnit test rule. The rule is declared once per test class and configured with the output directory to which the generated snippets should be written. This simplifies the implementation as thread local storage is no longer required to transfer information about the test that’s running into Spring REST Docs. Instead, this transfer is now handled by the new test rule. It has also simplified the configuration as it’s no longer necessary for users to provide a system property that configures the output directory. spring-restdocs-mockmvc contains code that’s specific to using Spring REST Docs with Spring MVC Test’s MockMvc. This is currently the only testing framework that’s supported, but it paves the way for adding support for additional frameworks. REST Assured is one that users seem particularly interested in (see gh-80 and gh-102). Closes gh-107
64 lines
1.3 KiB
Groovy
64 lines
1.3 KiB
Groovy
buildscript {
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
dependencies {
|
|
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.2.5.RELEASE'
|
|
}
|
|
}
|
|
|
|
plugins {
|
|
id "org.asciidoctor.convert" version "1.5.2"
|
|
}
|
|
|
|
apply plugin: 'java'
|
|
apply plugin: 'spring-boot'
|
|
apply plugin: 'eclipse'
|
|
|
|
repositories {
|
|
mavenLocal()
|
|
maven { url 'https://repo.spring.io/snapshot' }
|
|
mavenCentral()
|
|
}
|
|
|
|
group = 'com.example'
|
|
|
|
sourceCompatibility = 1.7
|
|
targetCompatibility = 1.7
|
|
|
|
dependencies {
|
|
compile 'org.springframework.boot:spring-boot-starter-data-jpa'
|
|
compile 'org.springframework.boot:spring-boot-starter-hateoas'
|
|
|
|
runtime 'com.h2database:h2'
|
|
runtime 'org.atteo:evo-inflector:1.2'
|
|
|
|
testCompile 'com.jayway.jsonpath:json-path'
|
|
testCompile 'org.springframework.boot:spring-boot-starter-test'
|
|
testCompile 'org.springframework.restdocs:spring-restdocs-mockmvc:1.0.0.BUILD-SNAPSHOT'
|
|
}
|
|
|
|
ext {
|
|
snippetsDir = file('build/generated-snippets')
|
|
}
|
|
|
|
test {
|
|
outputs.dir snippetsDir
|
|
}
|
|
|
|
asciidoctor {
|
|
sourceDir 'src/main/asciidoc' // Align with Maven's default location
|
|
attributes 'snippets': snippetsDir
|
|
inputs.dir snippetsDir
|
|
dependsOn test
|
|
}
|
|
|
|
jar {
|
|
dependsOn asciidoctor
|
|
from ("${asciidoctor.outputDir}/html5") {
|
|
into 'static/docs'
|
|
}
|
|
}
|
|
|
|
eclipseJdt.onlyIf { false }
|
|
cleanEclipseJdt.onlyIf { false } |