Skip to content

Commit 03d50c0

Browse files
committed
Update to gradle 5, spring-boot 2.1.1 restdocs 2.0.3, kotlin 1.3.10
Also remove lombok from sample
1 parent 1dd7bf3 commit 03d50c0

File tree

16 files changed

+237
-216
lines changed

16 files changed

+237
-216
lines changed

build.gradle.kts

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ import org.gradle.api.tasks.bundling.Jar
1212

1313
plugins {
1414
java
15-
kotlin("jvm") version "1.2.51" apply false
15+
kotlin("jvm") version "1.3.10" apply false
1616
id("pl.allegro.tech.build.axion-release") version "1.9.2"
1717
jacoco
1818
`maven-publish`
19-
id("org.jmailen.kotlinter") version "1.17.0" apply false
19+
id("org.jmailen.kotlinter") version "1.20.1" apply false
2020
id("com.github.kt3k.coveralls") version "2.8.2"
2121
id("com.jfrog.bintray") version "1.8.4" apply false
2222
}
@@ -63,9 +63,9 @@ allprojects {
6363
subprojects {
6464

6565
val jacksonVersion by extra { "2.9.5" }
66-
val springBootVersion by extra { "2.0.5.RELEASE" }
67-
val springRestDocsVersion by extra { "2.0.2.RELEASE" }
68-
val junitVersion by extra { "5.3.1" }
66+
val springBootVersion by extra { "2.1.1.RELEASE" }
67+
val springRestDocsVersion by extra { "2.0.3.RELEASE" }
68+
val junitVersion by extra { "5.3.2" }
6969

7070
tasks.withType<KotlinCompile> {
7171
kotlinOptions.jvmTarget = "1.8"
@@ -90,17 +90,20 @@ subprojects {
9090

9191
val sourcesJar by tasks.creating(Jar::class) {
9292
classifier = "sources"
93-
from(java.sourceSets["main"].allSource)
93+
from(sourceSets["main"].allSource)
9494
}
9595

9696
publishing {
97-
(publications) {
98-
"mavenJava"(MavenPublication::class) {
99-
from(components["java"])
100-
artifact(sourcesJar)
97+
publications {
98+
(publications) {
99+
register("mavenJava", MavenPublication::class) {
100+
from(components["java"])
101+
artifact(sourcesJar)
102+
}
101103
}
102104
}
103105
}
106+
104107
apply(plugin = "com.jfrog.bintray")
105108
configure<BintrayExtension> {
106109
user = project.findProperty("bintrayUser") as String? ?: System.getenv("BINTRAY_USER")
@@ -118,7 +121,7 @@ subprojects {
118121

119122
//coverall multi module plugin configuration starts here
120123
configure<CoverallsPluginExtension> {
121-
sourceDirs = nonSampleProjects.flatMap { it.java.sourceSets["main"].allSource.srcDirs }.filter { it.exists() }.map { it.path }
124+
sourceDirs = nonSampleProjects.flatMap { it.sourceSets["main"].allSource.srcDirs }.filter { it.exists() }.map { it.path }
122125
jacocoReportPath = "$buildDir/reports/jacoco/jacocoRootReport/jacocoRootReport.xml"
123126
}
124127

@@ -130,21 +133,21 @@ tasks {
130133
}
131134
}
132135

133-
val jacocoTestReport = tasks["jacocoTestReport"]
136+
val jacocoTestReport = this.getByName("jacocoTestReport")
134137
jacocoTestReport.dependsOn(nonSampleProjects.map { it.tasks["jacocoTestReport"] })
135138
jacocoMerge.dependsOn(jacocoTestReport)
136139

137140
val jacocoRootReport by creating(JacocoReport::class) {
138141
description = "Generates an aggregate report from all subprojects"
139142
group = "Coverage reports"
140143
dependsOn(jacocoMerge)
141-
sourceDirectories = files(nonSampleProjects.flatMap { it.java.sourceSets["main"].allSource.srcDirs.filter { it.exists() } } )
142-
classDirectories = files(nonSampleProjects.flatMap { it.java.sourceSets["main"].output } )
144+
setSourceDirectories(files(nonSampleProjects.flatMap { it.sourceSets["main"].allSource.srcDirs.filter { it.exists() } } ))
145+
setClassDirectories(files(nonSampleProjects.flatMap { it.sourceSets["main"].output } ))
143146
executionData(jacocoMerge.destinationFile)
144147
reports {
145148
html.isEnabled = true
146149
xml.isEnabled = true
147150
}
148151
}
149-
tasks["coveralls"].dependsOn(jacocoRootReport)
152+
getByName("coveralls").dependsOn(jacocoRootReport)
150153
}

gradle/wrapper/gradle-wrapper.jar

0 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

gradlew.bat

Lines changed: 84 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,84 @@
1-
@if "%DEBUG%" == "" @echo off
2-
@rem ##########################################################################
3-
@rem
4-
@rem Gradle startup script for Windows
5-
@rem
6-
@rem ##########################################################################
7-
8-
@rem Set local scope for the variables with windows NT shell
9-
if "%OS%"=="Windows_NT" setlocal
10-
11-
set DIRNAME=%~dp0
12-
if "%DIRNAME%" == "" set DIRNAME=.
13-
set APP_BASE_NAME=%~n0
14-
set APP_HOME=%DIRNAME%
15-
16-
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17-
set DEFAULT_JVM_OPTS=
18-
19-
@rem Find java.exe
20-
if defined JAVA_HOME goto findJavaFromJavaHome
21-
22-
set JAVA_EXE=java.exe
23-
%JAVA_EXE% -version >NUL 2>&1
24-
if "%ERRORLEVEL%" == "0" goto init
25-
26-
echo.
27-
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28-
echo.
29-
echo Please set the JAVA_HOME variable in your environment to match the
30-
echo location of your Java installation.
31-
32-
goto fail
33-
34-
:findJavaFromJavaHome
35-
set JAVA_HOME=%JAVA_HOME:"=%
36-
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37-
38-
if exist "%JAVA_EXE%" goto init
39-
40-
echo.
41-
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42-
echo.
43-
echo Please set the JAVA_HOME variable in your environment to match the
44-
echo location of your Java installation.
45-
46-
goto fail
47-
48-
:init
49-
@rem Get command-line arguments, handling Windows variants
50-
51-
if not "%OS%" == "Windows_NT" goto win9xME_args
52-
53-
:win9xME_args
54-
@rem Slurp the command line arguments.
55-
set CMD_LINE_ARGS=
56-
set _SKIP=2
57-
58-
:win9xME_args_slurp
59-
if "x%~1" == "x" goto execute
60-
61-
set CMD_LINE_ARGS=%*
62-
63-
:execute
64-
@rem Setup the command line
65-
66-
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67-
68-
@rem Execute Gradle
69-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70-
71-
:end
72-
@rem End local scope for the variables with windows NT shell
73-
if "%ERRORLEVEL%"=="0" goto mainEnd
74-
75-
:fail
76-
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77-
rem the _cmd.exe /c_ return code!
78-
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79-
exit /b 1
80-
81-
:mainEnd
82-
if "%OS%"=="Windows_NT" endlocal
83-
84-
:omega
1+
@if "%DEBUG%" == "" @echo off
2+
@rem ##########################################################################
3+
@rem
4+
@rem Gradle startup script for Windows
5+
@rem
6+
@rem ##########################################################################
7+
8+
@rem Set local scope for the variables with windows NT shell
9+
if "%OS%"=="Windows_NT" setlocal
10+
11+
set DIRNAME=%~dp0
12+
if "%DIRNAME%" == "" set DIRNAME=.
13+
set APP_BASE_NAME=%~n0
14+
set APP_HOME=%DIRNAME%
15+
16+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17+
set DEFAULT_JVM_OPTS=
18+
19+
@rem Find java.exe
20+
if defined JAVA_HOME goto findJavaFromJavaHome
21+
22+
set JAVA_EXE=java.exe
23+
%JAVA_EXE% -version >NUL 2>&1
24+
if "%ERRORLEVEL%" == "0" goto init
25+
26+
echo.
27+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28+
echo.
29+
echo Please set the JAVA_HOME variable in your environment to match the
30+
echo location of your Java installation.
31+
32+
goto fail
33+
34+
:findJavaFromJavaHome
35+
set JAVA_HOME=%JAVA_HOME:"=%
36+
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37+
38+
if exist "%JAVA_EXE%" goto init
39+
40+
echo.
41+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42+
echo.
43+
echo Please set the JAVA_HOME variable in your environment to match the
44+
echo location of your Java installation.
45+
46+
goto fail
47+
48+
:init
49+
@rem Get command-line arguments, handling Windows variants
50+
51+
if not "%OS%" == "Windows_NT" goto win9xME_args
52+
53+
:win9xME_args
54+
@rem Slurp the command line arguments.
55+
set CMD_LINE_ARGS=
56+
set _SKIP=2
57+
58+
:win9xME_args_slurp
59+
if "x%~1" == "x" goto execute
60+
61+
set CMD_LINE_ARGS=%*
62+
63+
:execute
64+
@rem Setup the command line
65+
66+
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67+
68+
@rem Execute Gradle
69+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70+
71+
:end
72+
@rem End local scope for the variables with windows NT shell
73+
if "%ERRORLEVEL%"=="0" goto mainEnd
74+
75+
:fail
76+
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77+
rem the _cmd.exe /c_ return code!
78+
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79+
exit /b 1
80+
81+
:mainEnd
82+
if "%OS%"=="Windows_NT" endlocal
83+
84+
:omega

restdocs-api-spec-gradle-plugin/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ plugins {
1515
}
1616

1717
gradlePlugin {
18-
(plugins) {
19-
"com.epages.restdocs-api-spec" {
18+
plugins {
19+
register("com.epages.restdocs-api-spec") {
2020
id = "com.epages.restdocs-api-spec"
2121
implementationClass = "com.epages.restdocs.apispec.gradle.RestdocsApiSpecPlugin"
2222
}

restdocs-api-spec/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ val junitVersion: String by extra
1515

1616
dependencies {
1717
compile(kotlin("stdlib-jdk8"))
18+
compile(kotlin("reflect"))
1819

1920
compile("org.springframework.restdocs:spring-restdocs-mockmvc:$springRestDocsVersion")
2021
compile("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion")

restdocs-api-spec/src/test/kotlin/com/epages/restdocs/apispec/ResourceSnippetIntegrationTest.kt

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -165,28 +165,28 @@ open class ResourceSnippetIntegrationTest(@Autowired private val mockMvc: MockMv
165165
fun main(args: Array<String>) {
166166
SpringApplication.run(TestApplication::class.java, *args)
167167
}
168-
}
169168

170-
@RestController
171-
internal open class TestController {
172-
173-
@PostMapping(path = ["/some/{someId}/other/{otherId}"])
174-
fun doSomething(
175-
@PathVariable someId: String,
176-
@PathVariable otherId: Int?,
177-
@RequestHeader("X-Custom-Header") customHeader: String,
178-
@RequestBody testDataHolder: TestDataHolder
179-
): ResponseEntity<Resource<TestDataHolder>> {
180-
val resource = Resource(testDataHolder.copy(id = UUID.randomUUID().toString()))
181-
val link = BasicLinkBuilder.linkToCurrentMapping().slash("some").slash(someId).slash("other").slash(otherId).toUri().toString()
182-
resource.add(Link(link, Link.REL_SELF))
183-
resource.add(Link(link, "multiple"))
184-
resource.add(Link(link, "multiple"))
185-
186-
return ResponseEntity
187-
.ok()
188-
.header("X-Custom-Header", customHeader)
189-
.body<Resource<TestDataHolder>>(resource)
169+
@RestController
170+
internal open class TestController {
171+
172+
@PostMapping(path = ["/some/{someId}/other/{otherId}"])
173+
fun doSomething(
174+
@PathVariable someId: String,
175+
@PathVariable otherId: Int?,
176+
@RequestHeader("X-Custom-Header") customHeader: String,
177+
@RequestBody testDataHolder: TestDataHolder
178+
): ResponseEntity<Resource<TestDataHolder>> {
179+
val resource = Resource(testDataHolder.copy(id = UUID.randomUUID().toString()))
180+
val link = BasicLinkBuilder.linkToCurrentMapping().slash("some").slash(someId).slash("other").slash(otherId).toUri().toString()
181+
resource.add(Link(link, Link.REL_SELF))
182+
resource.add(Link(link, "multiple"))
183+
resource.add(Link(link, "multiple"))
184+
185+
return ResponseEntity
186+
.ok()
187+
.header("X-Custom-Header", customHeader)
188+
.body<Resource<TestDataHolder>>(resource)
189+
}
190190
}
191191
}
192192

samples/restdocs-api-spec-sample/build.gradle

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
buildscript {
22
ext {
3-
springBootVersion = '2.0.5.RELEASE'
3+
springBootVersion = '2.1.1.RELEASE'
44
}
55
repositories {
66
mavenCentral()
@@ -34,15 +34,13 @@ dependencies {
3434
compile('org.springframework.boot:spring-boot-starter-data-jpa')
3535
compile('org.springframework.boot:spring-boot-starter-data-rest')
3636
runtime('com.h2database:h2')
37-
compileOnly('org.projectlombok:lombok:1.16.20') // see https://github.com/rzwitserloot/lombok/issues/1716
38-
testCompileOnly('org.projectlombok:lombok:1.16.20')
39-
testCompile('org.junit.jupiter:junit-jupiter-engine:5.2.0')
37+
testCompile('org.junit.jupiter:junit-jupiter-engine:5.3.2')
4038

4139
testCompile('org.springframework.boot:spring-boot-starter-test')
4240
testCompile('org.springframework.restdocs:spring-restdocs-mockmvc')
4341

44-
testCompile('com.epages:restdocs-api-spec:0.5.0')
45-
//testCompile project(':restdocs-api-spec') //enable for depending on the submodule directly
42+
//testCompile('com.epages:restdocs-api-spec:0.5.0')
43+
testCompile project(':restdocs-api-spec') //enable for depending on the submodule directly
4644
testCompile('com.google.guava:guava:23.0')
4745
}
4846

0 commit comments

Comments
 (0)