Skip to content

Commit f6c3a65

Browse files
Spring Boot 3.x/Spring Framework 6.x Support (#13)
1 parent 007a534 commit f6c3a65

File tree

198 files changed

+2099
-1113
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+2099
-1113
lines changed

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ indent_size = 4
99
indent_style = space
1010
insert_final_newline = true
1111

12+
[*.java]
13+
ij_java_class_count_to_use_import_on_demand = 999
14+
ij_java_names_count_to_use_import_on_demand = 999
15+
1216
[*.{bat,cmd}]
1317
end_of_line = crlf
1418

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- '*'
77
pull_request:
88
branches:
9-
- $default-branch
9+
- '*'
1010

1111
jobs:
1212
build:

LICENSE_HEADER.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright ${year} the original author or authors.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public class ExampleConfiguration {
166166

167167
### Build Requirements
168168

169-
* Java 17 or above to build. The release jars are compiled to Java 8 bytecode. Integration tests are compiled to Java 17 bytecode.
169+
* Java 17 or above to build and use.
170170

171171
To build:
172172

RELEASE_NOTES.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
# Release Notes
22

3-
## 0.7.0-SNAPSHOT
3+
## 1.0.0-SNAPSHOT
44
Released N/A
55

6+
- Breaking change
7+
- Updated to support Spring 6.x and Spring Boot 3.x. This brings with it a minimum Java version of 17. With the Spring
8+
upgrade comes a switch to the Jakara EE Servlet API instead of Java EE.
9+
- Update build to Gradle 8.9
10+
- Added support for ErrorProne and NullAway for compile time checks of nullability.
11+
612
## 0.6.0
713
Released 2023-12-01
814

build.gradle.kts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ plugins {
66
}
77

88
allprojects {
9-
apply(plugin = "com.mattbertolini.buildlogic.project-conventions")
10-
119
group = "com.mattbertolini"
12-
version = "0.7.0-SNAPSHOT"
10+
version = "1.0.0-SNAPSHOT"
1311
}
1412

1513
val rootJacocoDir = "reports/jacoco/testCodeCoverageReport"

buildSrc/build.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,11 @@ plugins {
33
}
44

55
repositories {
6+
gradlePluginPortal()
67
mavenCentral()
78
}
9+
10+
dependencies {
11+
implementation("net.ltgt.gradle:gradle-errorprone-plugin:4.0.1")
12+
implementation("gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:0.16.1")
13+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package com.mattbertolini.buildlogic
2+
3+
import net.ltgt.gradle.errorprone.CheckSeverity
4+
import net.ltgt.gradle.errorprone.errorprone
5+
6+
plugins {
7+
id("net.ltgt.errorprone")
8+
}
9+
10+
val libsCatalog = versionCatalogs.named("libs")
11+
val errorProneCore = libsCatalog.findLibrary("errorProneCore").orElseThrow()
12+
val errorProneAnnotations = libsCatalog.findLibrary("errorProneAnnotations").orElseThrow();
13+
val nullAway = libsCatalog.findLibrary("nullAway").orElseThrow()
14+
val nullAwayAnnotations = libsCatalog.findLibrary("nullAwayAnnotations").orElseThrow()
15+
16+
dependencies {
17+
errorprone(errorProneCore)
18+
errorprone(nullAway)
19+
}
20+
21+
project.extensions.getByType<SourceSetContainer>().configureEach {
22+
dependencies.add(compileOnlyConfigurationName, errorProneAnnotations)
23+
dependencies.add(compileOnlyConfigurationName, nullAwayAnnotations)
24+
}
25+
26+
tasks.withType<JavaCompile>().configureEach {
27+
options.isFork = true
28+
options.errorprone {
29+
disableWarningsInGeneratedCode.set(true)
30+
check("NullAway", CheckSeverity.ERROR)
31+
option("NullAway:AnnotatedPackages", "com.mattbertolini")
32+
}
33+
}

buildSrc/src/main/kotlin/com/mattbertolini/buildlogic/java-conventions.gradle.kts

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package com.mattbertolini.buildlogic
33
plugins {
44
java
55
jacoco
6+
id("com.mattbertolini.buildlogic.project-conventions")
7+
id("com.mattbertolini.buildlogic.error-prone")
68
}
79

810
val versionCatalog = versionCatalogs.named("libs")
@@ -13,10 +15,6 @@ java {
1315
}
1416
}
1517

16-
tasks.named<JavaCompile>("compileJava").configure {
17-
options.release.set(8)
18-
}
19-
2018
testing {
2119
suites {
2220
named<JvmTestSuite>("test").configure {
@@ -34,30 +32,25 @@ tasks.named<Jar>("jar").configure {
3432
}
3533
}
3634

37-
val springVersion: String = versionCatalog.findVersion("spring").orElseThrow().toString()
38-
val springBootVersion: String = versionCatalog.findVersion("springBoot").orElseThrow().toString()
39-
4035
val javadocLinks = arrayOf(
41-
"https://docs.oracle.com/javase/8/docs/api/",
42-
"https://docs.oracle.com/javaee/7/api/",
43-
"https://docs.spring.io/spring-framework/docs/$springVersion/javadoc-api/",
44-
"https://docs.spring.io/spring-boot/docs/$springBootVersion/api/"
36+
"https://docs.oracle.com/en/java/javase/17/docs/api",
37+
"https://jakarta.ee/specifications/platform/11/apidocs/",
38+
"https://docs.spring.io/spring-framework/docs/current/javadoc-api/",
39+
"https://docs.spring.io/spring-boot/api/java/"
4540
)
4641

4742
tasks.named<Javadoc>("javadoc").configure {
4843
options {
4944
this as StandardJavadocDocletOptions
50-
source = "8"
45+
source = "17"
5146
links(*javadocLinks)
5247
addStringOption("Xdoclint:none", "-quiet")
53-
if (java.toolchain.languageVersion.get().asInt() >= 9) {
54-
addBooleanOption("html5", true)
55-
}
48+
addBooleanOption("html5", true)
5649
}
5750
}
5851

5952
val jacocoVersion: String = versionCatalog.findVersion("jacoco").orElseThrow().toString()
60-
configure<JacocoPluginExtension> {
53+
jacoco {
6154
toolVersion = jacocoVersion
6255
}
6356

@@ -69,4 +62,6 @@ tasks.named<JacocoReport>("jacocoTestReport").configure {
6962
}
7063
}
7164

72-
tasks.test { finalizedBy(tasks.jacocoTestReport) }
65+
tasks.named("test").configure {
66+
finalizedBy(tasks.named("jacocoTestReport"))
67+
}

buildSrc/src/main/kotlin/com/mattbertolini/buildlogic/java-library.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ package com.mattbertolini.buildlogic
22

33
plugins {
44
`java-library`
5+
id("com.mattbertolini.buildlogic.java-conventions")
56
}
6-
7-
apply(plugin = "com.mattbertolini.buildlogic.java-conventions")

0 commit comments

Comments
 (0)