Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Commit dd3dd52

Browse files
authored
JDK9 doclet & java 8+9 builds (#258)
Fixes #243 Closes #251 - entire project and samples are built on both configs (kotlin sample only java 8) - added JDK9 doclet from #251 as a new module - doclet versions are built and deployed during respective java version build. - removed lombok
1 parent 6ddcee5 commit dd3dd52

File tree

32 files changed

+934
-107
lines changed

32 files changed

+934
-107
lines changed

.travis.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ sudo: false
33
dist: trusty
44
jdk:
55
- oraclejdk8
6+
- oraclejdk9
67
before_cache:
78
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
89
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
@@ -19,18 +20,20 @@ script:
1920
- mvn install -B -V
2021
- cd samples
2122
- mvn install -B -V
22-
- cd java-webmvc
23-
- ./gradlew check
24-
- cd ..
25-
- cd kotlin-webmvc
26-
- ./gradlew check
27-
- cd ../..
23+
- test "$TRAVIS_JDK_VERSION" = "oraclejdk8" && cd java-webmvc && ./gradlew check && cd .. || (exit 0)
24+
- test "$TRAVIS_JDK_VERSION" = "oraclejdk8" && cd kotlin-webmvc && ./gradlew check && cd .. || (exit 0)
2825
after_success:
2926
- test "$TRAVIS_BRANCH" = "master"
3027
&& test "$TRAVIS_PULL_REQUEST" = "false"
3128
&& test "$TRAVIS_JDK_VERSION" = "oraclejdk8"
3229
&& "$DEPLOY_DIR/decrypt.sh"
3330
&& mvn deploy --settings "$DEPLOY_DIR/travis-settings.xml" -DskipTests=true -B -V
31+
- test "$TRAVIS_BRANCH" = "master"
32+
&& test "$TRAVIS_PULL_REQUEST" = "false"
33+
&& test "$TRAVIS_JDK_VERSION" = "oraclejdk9"
34+
&& cd spring-auto-restdocs-json-doclet-jdk9
35+
&& "$DEPLOY_DIR/decrypt.sh"
36+
&& mvn deploy --settings "$DEPLOY_DIR/travis-settings.xml" -DskipTests=true -B -V
3437
branches:
3538
only:
3639
- master

pom.xml

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@
1212
<description>Parent POM for Spring Auto REST Docs</description>
1313
<url>https://github.com/scacap/spring-auto-restdocs</url>
1414

15-
<modules>
16-
<module>spring-auto-restdocs-json-doclet</module>
17-
<module>spring-auto-restdocs-core</module>
18-
<module>spring-auto-restdocs-docs</module>
19-
<module>spring-auto-restdocs-dokka-json</module>
20-
</modules>
21-
2215
<organization>
2316
<name>Scalable Capital GmbH</name>
2417
<url>https://scalable.capital</url>
@@ -53,9 +46,6 @@
5346
</developers>
5447

5548
<properties>
56-
<java.version>1.8</java.version>
57-
<maven.compiler.source>1.8</maven.compiler.source>
58-
<maven.compiler.target>1.8</maven.compiler.target>
5949
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
6050
<snippetsDirectory>${project.build.directory}/generated-snippets</snippetsDirectory>
6151
<spring-restdocs.version>2.0.2.RELEASE</spring-restdocs.version>
@@ -141,7 +131,7 @@
141131
<plugin>
142132
<groupId>org.apache.maven.plugins</groupId>
143133
<artifactId>maven-compiler-plugin</artifactId>
144-
<version>3.7.0</version>
134+
<version>3.8.0</version>
145135
</plugin>
146136
<plugin>
147137
<groupId>org.apache.maven.plugins</groupId>
@@ -151,7 +141,7 @@
151141
<plugin>
152142
<groupId>org.apache.maven.plugins</groupId>
153143
<artifactId>maven-javadoc-plugin</artifactId>
154-
<version>3.0.0</version>
144+
<version>3.0.1</version>
155145
</plugin>
156146
<plugin>
157147
<groupId>org.apache.maven.plugins</groupId>
@@ -166,7 +156,7 @@
166156
<plugin>
167157
<groupId>org.apache.maven.plugins</groupId>
168158
<artifactId>maven-surefire-plugin</artifactId>
169-
<version>2.20.1</version>
159+
<version>2.21.0</version>
170160
</plugin>
171161
<plugin>
172162
<groupId>org.asciidoctor</groupId>
@@ -183,6 +173,41 @@
183173
</build>
184174

185175
<profiles>
176+
<profile>
177+
<id>java8</id>
178+
<activation>
179+
<jdk>1.8</jdk>
180+
</activation>
181+
<properties>
182+
<java.version>1.8</java.version>
183+
<maven.compiler.source>1.8</maven.compiler.source>
184+
<maven.compiler.target>1.8</maven.compiler.target>
185+
<json-doclet.artifactId>spring-auto-restdocs-json-doclet</json-doclet.artifactId>
186+
</properties>
187+
<modules>
188+
<module>spring-auto-restdocs-json-doclet</module>
189+
<module>spring-auto-restdocs-dokka-json</module>
190+
<module>spring-auto-restdocs-core</module>
191+
<module>spring-auto-restdocs-docs</module>
192+
</modules>
193+
</profile>
194+
<profile>
195+
<id>java9</id>
196+
<activation>
197+
<jdk>9</jdk>
198+
</activation>
199+
<properties>
200+
<java.version>9</java.version>
201+
<maven.compiler.source>9</maven.compiler.source>
202+
<maven.compiler.target>9</maven.compiler.target>
203+
<json-doclet.artifactId>spring-auto-restdocs-json-doclet-jdk9</json-doclet.artifactId>
204+
</properties>
205+
<modules>
206+
<module>spring-auto-restdocs-json-doclet-jdk9</module>
207+
<module>spring-auto-restdocs-core</module>
208+
<module>spring-auto-restdocs-docs</module>
209+
</modules>
210+
</profile>
186211
<profile>
187212
<id>sign-artifacts</id>
188213
<activation>

samples/java-webmvc/pom.xml

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@
3232
</licenses>
3333

3434
<properties>
35-
<java.version>1.8</java.version>
36-
<maven.compiler.source>1.8</maven.compiler.source>
37-
<maven.compiler.target>1.8</maven.compiler.target>
3835
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3936
<start-class>capital.scalable.restdocs.example.Application</start-class>
4037
<spring-restdocs.version>2.0.2.RELEASE</spring-restdocs.version>
@@ -60,13 +57,6 @@
6057
<artifactId>spring-security-oauth2</artifactId>
6158
<version>2.3.0.RELEASE</version>
6259
</dependency>
63-
<dependency>
64-
<groupId>org.projectlombok</groupId>
65-
<artifactId>lombok</artifactId>
66-
<!-- Lombok 1.16.20+ is required for JDK9 -->
67-
<version>1.16.20</version>
68-
<scope>provided</scope>
69-
</dependency>
7060
<dependency>
7161
<groupId>org.springframework.boot</groupId>
7262
<artifactId>spring-boot-starter-test</artifactId>
@@ -96,8 +86,55 @@
9686
<groupId>org.springframework.data</groupId>
9787
<artifactId>spring-data-commons</artifactId>
9888
</dependency>
89+
<dependency>
90+
<groupId>javax.xml.bind</groupId>
91+
<artifactId>jaxb-api</artifactId>
92+
<version>2.2.11</version>
93+
</dependency>
94+
<dependency>
95+
<groupId>com.sun.xml.bind</groupId>
96+
<artifactId>jaxb-core</artifactId>
97+
<version>2.2.11</version>
98+
</dependency>
99+
<dependency>
100+
<groupId>com.sun.xml.bind</groupId>
101+
<artifactId>jaxb-impl</artifactId>
102+
<version>2.2.11</version>
103+
</dependency>
104+
<dependency>
105+
<groupId>javax.activation</groupId>
106+
<artifactId>activation</artifactId>
107+
<version>1.1.1</version>
108+
</dependency>
99109
</dependencies>
100110

111+
<profiles>
112+
<profile>
113+
<id>java8</id>
114+
<activation>
115+
<jdk>1.8</jdk>
116+
</activation>
117+
<properties>
118+
<java.version>1.8</java.version>
119+
<maven.compiler.source>1.8</maven.compiler.source>
120+
<maven.compiler.target>1.8</maven.compiler.target>
121+
<json-doclet.artifactId>spring-auto-restdocs-json-doclet</json-doclet.artifactId>
122+
</properties>
123+
</profile>
124+
<profile>
125+
<id>java9</id>
126+
<activation>
127+
<jdk>9</jdk>
128+
</activation>
129+
<properties>
130+
<java.version>9</java.version>
131+
<maven.compiler.source>9</maven.compiler.source>
132+
<maven.compiler.target>9</maven.compiler.target>
133+
<json-doclet.artifactId>spring-auto-restdocs-json-doclet-jdk9</json-doclet.artifactId>
134+
</properties>
135+
</profile>
136+
</profiles>
137+
101138
<build>
102139
<plugins>
103140
<plugin>
@@ -212,7 +249,7 @@
212249
<doclet>capital.scalable.restdocs.jsondoclet.ExtractDocumentationAsJsonDoclet</doclet>
213250
<docletArtifact>
214251
<groupId>capital.scalable</groupId>
215-
<artifactId>spring-auto-restdocs-json-doclet</artifactId>
252+
<artifactId>${json-doclet.artifactId}</artifactId>
216253
<version>${spring-auto-restdocs.version}</version>
217254
</docletArtifact>
218255
<reportOutputDirectory>${project.build.directory}</reportOutputDirectory>

samples/java-webmvc/src/main/java/capital/scalable/restdocs/example/items/ItemResource.java

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
import capital.scalable.restdocs.example.constraints.English;
3636
import capital.scalable.restdocs.example.constraints.German;
3737
import capital.scalable.restdocs.example.constraints.Id;
38-
import lombok.Data;
39-
import lombok.Value;
4038
import org.springframework.data.domain.Page;
4139
import org.springframework.data.domain.PageImpl;
4240
import org.springframework.data.domain.Pageable;
@@ -272,22 +270,43 @@ static class CloneData {
272270
private String name;
273271
}
274272

275-
@Data
276273
static class Command {
277274
/**
278275
* Command to execute
279276
*/
280277
@NotBlank
281278
private String command;
279+
280+
public Command() {
281+
}
282+
283+
public Command(@NotBlank String command) {
284+
this.command = command;
285+
}
286+
287+
public void setCommand(String command) {
288+
this.command = command;
289+
}
290+
291+
public String getCommand() {
292+
return command;
293+
}
282294
}
283295

284-
@Value
285296
static class CommandResult {
286297
/**
287298
* Log output
288299
*/
289300
@NotBlank
290301
private String output;
302+
303+
public CommandResult(@NotBlank String output) {
304+
this.output = output;
305+
}
306+
307+
public String getOutput() {
308+
return output;
309+
}
291310
}
292311

293312
@ResponseStatus(HttpStatus.NOT_FOUND)

samples/java-webmvc/src/main/java/capital/scalable/restdocs/example/items/ItemResponse.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,10 @@
2525
import java.util.List;
2626

2727
import com.fasterxml.jackson.annotation.JsonIgnore;
28-
import lombok.AllArgsConstructor;
2928

3029
/**
3130
* Java object for a single JSON item.
3231
*/
33-
@AllArgsConstructor
3432
class ItemResponse {
3533
/**
3634
* Unique ID. This text comes directly from Javadoc.
@@ -68,6 +66,16 @@ class ItemResponse {
6866
*/
6967
private String[] tags;
7068

69+
ItemResponse(String id, String desc, Metadata meta, Attributes attributes, List<ItemResponse> children,
70+
String[] tags) {
71+
this.id = id;
72+
this.desc = desc;
73+
this.meta = meta;
74+
this.attributes = attributes;
75+
this.children = children;
76+
this.tags = tags;
77+
}
78+
7179
/**
7280
* Some information | description about the item.
7381
*/

samples/java-webmvc/src/main/java/capital/scalable/restdocs/example/items/ItemUpdateRequest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,11 @@
2525
import capital.scalable.restdocs.example.constraints.English;
2626
import capital.scalable.restdocs.example.constraints.German;
2727
import capital.scalable.restdocs.example.constraints.OneOf;
28-
import lombok.Data;
2928
import org.hibernate.validator.constraints.Length;
3029

3130
/**
3231
* Java object for the JSON request.
3332
*/
34-
@Data
3533
class ItemUpdateRequest {
3634
/**
3735
* Some information about the item.
@@ -53,4 +51,8 @@ class ItemUpdateRequest {
5351
@OneOf(value = {"small", "big"}, groups = English.class)
5452
})
5553
private String type;
54+
55+
String getDescription() {
56+
return description;
57+
}
5658
}

0 commit comments

Comments
 (0)