Make things less Gradle-specific and provide Maven config in samples
Previously, the project provided a Gradle plugin and was only really intended for use with Gradle. This had influenced a number of design choices that have proven to be less than ideal when attempting to use the project with Maven. This commit backs off from a number of design decisions that worked well with Gradle but less so with Maven. Part of this is that the Gradle plugin is (temporarily?) no more. It's been removed in favour of configuring things directly in build.gradle. While this slightly increases the amount of configuration required it makes things far more flexible. Both samples have been updated with modified Gradle configuration and new Maven configuration. The README has also been updated to reflect these changes.
This commit is contained in:
@@ -1,26 +1,23 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven {
|
||||
url 'https://repo.spring.io/libs-milestone'
|
||||
}
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'org.springframework.restdocs:spring-restdocs-gradle-plugin:0.1.0.BUILD-SNAPSHOT'
|
||||
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.2.0.M2'
|
||||
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.2.1.RELEASE'
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "org.asciidoctor.convert" version "1.5.2"
|
||||
}
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'spring-boot'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'org.springframework.restdocs'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven {
|
||||
url 'https://repo.spring.io/libs-milestone'
|
||||
}
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
group = 'com.example'
|
||||
@@ -31,12 +28,28 @@ dependencies {
|
||||
|
||||
runtime 'com.h2database:h2'
|
||||
|
||||
documentationCompile 'com.jayway.jsonpath:json-path'
|
||||
documentationCompile 'org.springframework.boot:spring-boot-starter-test'
|
||||
documentationCompile 'org.springframework.restdocs:spring-restdocs-core:0.1.0.BUILD-SNAPSHOT'
|
||||
testCompile 'com.jayway.jsonpath:json-path'
|
||||
testCompile 'org.springframework.boot:spring-boot-starter-test'
|
||||
testCompile 'org.springframework.restdocs:spring-restdocs-core:0.1.0.BUILD-SNAPSHOT'
|
||||
|
||||
}
|
||||
|
||||
ext {
|
||||
generatedDocumentation = file('build/generated-snippets')
|
||||
}
|
||||
|
||||
test {
|
||||
systemProperty 'org.springframework.restdocs.outputDir', generatedDocumentation
|
||||
outputs.dir generatedDocumentation
|
||||
}
|
||||
|
||||
asciidoctor {
|
||||
sourceDir 'src/main/asciidoc' // Align with Maven's default location
|
||||
attributes 'generated': generatedDocumentation
|
||||
inputs.dir generatedDocumentation
|
||||
dependsOn test
|
||||
}
|
||||
|
||||
task wrapper(type: Wrapper) {
|
||||
gradleVersion = '2.1'
|
||||
}
|
||||
|
||||
99
rest-notes-spring-data-rest/pom.xml
Normal file
99
rest-notes-spring-data-rest/pom.xml
Normal file
@@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>rest-notes-spring-hateoas</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>1.2.1.RELEASE</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-rest</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jayway.jsonpath</groupId>
|
||||
<artifactId>json-path</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.restdocs</groupId>
|
||||
<artifactId>spring-restdocs-core</artifactId>
|
||||
<version>0.1.0.BUILD-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>**/*Documentation.java</include>
|
||||
</includes>
|
||||
<systemPropertyVariables>
|
||||
<org.springframework.restdocs.outputDir>${project.build.directory}/generated-snippets</org.springframework.restdocs.outputDir>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.asciidoctor</groupId>
|
||||
<artifactId>asciidoctor-maven-plugin</artifactId>
|
||||
<version>1.5.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-docs</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>process-asciidoc</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<backend>html</backend>
|
||||
<doctype>book</doctype>
|
||||
<attributes>
|
||||
<generated>${project.build.directory}/generated-snippets</generated>
|
||||
</attributes>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -1 +0,0 @@
|
||||
org.springframework.restdocs.outputDir = build/generated-documentation
|
||||
Reference in New Issue
Block a user