mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-12-27 10:57:28 +00:00
Support building with Java 17
Needed to remove ErrorProne and Nullaway compiler plugins Fixes #2136
This commit is contained in:
parent
fc1c7490ed
commit
828940e5a1
7 changed files with 20 additions and 78 deletions
2
.github/workflows/gradle-build.yml
vendored
2
.github/workflows/gradle-build.yml
vendored
|
|
@ -15,7 +15,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
java: [ '25' ]
|
java: [ '17' ]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
|
||||||
2
.github/workflows/maven-build.yml
vendored
2
.github/workflows/maven-build.yml
vendored
|
|
@ -15,7 +15,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
java: [ '25' ]
|
java: [ '17' ]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
|
|
||||||
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
|
|
||||||
--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
|
|
||||||
--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
|
|
||||||
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
|
|
||||||
--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
|
|
||||||
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
|
|
||||||
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
|
|
||||||
--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
|
|
||||||
--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
# Enable auto-env through the sdkman_auto_env config
|
|
||||||
# Add key=value pairs of SDKs to use below
|
|
||||||
java=25-librca
|
|
||||||
|
|
@ -14,7 +14,7 @@ See the presentation here:
|
||||||
## Run Petclinic locally
|
## Run Petclinic locally
|
||||||
|
|
||||||
Spring Petclinic is a [Spring Boot](https://spring.io/guides/gs/spring-boot) application built using [Maven](https://spring.io/guides/gs/maven/) or [Gradle](https://spring.io/guides/gs/gradle/).
|
Spring Petclinic is a [Spring Boot](https://spring.io/guides/gs/spring-boot) application built using [Maven](https://spring.io/guides/gs/maven/) or [Gradle](https://spring.io/guides/gs/gradle/).
|
||||||
Java 25 or later is required for the build, but the application can run with Java 17 or newer:
|
Java 17 or later is required for the build, and the application can run with Java 17 or newer:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/spring-projects/spring-petclinic.git
|
git clone https://github.com/spring-projects/spring-petclinic.git
|
||||||
|
|
|
||||||
24
build.gradle
24
build.gradle
|
|
@ -7,7 +7,6 @@ plugins {
|
||||||
id 'org.cyclonedx.bom' version '3.0.2'
|
id 'org.cyclonedx.bom' version '3.0.2'
|
||||||
id 'io.spring.javaformat' version '0.0.47'
|
id 'io.spring.javaformat' version '0.0.47'
|
||||||
id "io.spring.nohttp" version "0.0.11"
|
id "io.spring.nohttp" version "0.0.11"
|
||||||
id 'net.ltgt.errorprone' version '4.3.0'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gradle.startParameter.excludedTaskNames += [ "checkFormatAot", "checkFormatAotTest" ]
|
gradle.startParameter.excludedTaskNames += [ "checkFormatAot", "checkFormatAotTest" ]
|
||||||
|
|
@ -17,7 +16,7 @@ version = '4.0.0-SNAPSHOT'
|
||||||
|
|
||||||
java {
|
java {
|
||||||
toolchain {
|
toolchain {
|
||||||
languageVersion = JavaLanguageVersion.of(25)
|
languageVersion = JavaLanguageVersion.of(17)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -30,14 +29,12 @@ ext.springJavaformatCheckstyleVersion = "0.0.47"
|
||||||
ext.webjarsLocatorLiteVersion = "1.1.2"
|
ext.webjarsLocatorLiteVersion = "1.1.2"
|
||||||
ext.webjarsFontawesomeVersion = "4.7.0"
|
ext.webjarsFontawesomeVersion = "4.7.0"
|
||||||
ext.webjarsBootstrapVersion = "5.3.8"
|
ext.webjarsBootstrapVersion = "5.3.8"
|
||||||
ext.errorProneVersion = "2.42.0"
|
|
||||||
ext.nullAwayVersion = "0.12.10"
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-cache'
|
implementation 'org.springframework.boot:spring-boot-starter-cache'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
|
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-webmvc'
|
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-validation'
|
implementation 'org.springframework.boot:spring-boot-starter-validation'
|
||||||
implementation 'javax.cache:cache-api'
|
implementation 'javax.cache:cache-api'
|
||||||
implementation 'jakarta.xml.bind:jakarta.xml.bind-api'
|
implementation 'jakarta.xml.bind:jakarta.xml.bind-api'
|
||||||
|
|
@ -59,8 +56,6 @@ dependencies {
|
||||||
testImplementation 'org.testcontainers:testcontainers-mysql'
|
testImplementation 'org.testcontainers:testcontainers-mysql'
|
||||||
checkstyle "io.spring.javaformat:spring-javaformat-checkstyle:${springJavaformatCheckstyleVersion}"
|
checkstyle "io.spring.javaformat:spring-javaformat-checkstyle:${springJavaformatCheckstyleVersion}"
|
||||||
checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}"
|
checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}"
|
||||||
errorprone "com.google.errorprone:error_prone_core:${errorProneVersion}"
|
|
||||||
errorprone "com.uber.nullaway:nullaway:${nullAwayVersion}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named('test') {
|
tasks.named('test') {
|
||||||
|
|
@ -77,21 +72,6 @@ checkstyleNohttp {
|
||||||
configFile = file('src/checkstyle/nohttp-checkstyle.xml')
|
configFile = file('src/checkstyle/nohttp-checkstyle.xml')
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(JavaCompile).configureEach {
|
|
||||||
options.release = 17
|
|
||||||
options.errorprone {
|
|
||||||
disableAllChecks = true
|
|
||||||
}
|
|
||||||
if (name.equals("compileJava")) {
|
|
||||||
options.errorprone {
|
|
||||||
error("NullAway")
|
|
||||||
option("NullAway:OnlyNullMarked", "true")
|
|
||||||
option("NullAway:CustomContractAnnotations", "org.springframework.lang.Contract")
|
|
||||||
option("NullAway:JSpecifyMode", "true")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.named("formatMain").configure { dependsOn("checkstyleMain") }
|
tasks.named("formatMain").configure { dependsOn("checkstyleMain") }
|
||||||
tasks.named("formatMain").configure { dependsOn("checkstyleNohttp") }
|
tasks.named("formatMain").configure { dependsOn("checkstyleNohttp") }
|
||||||
|
|
||||||
|
|
|
||||||
55
pom.xml
55
pom.xml
|
|
@ -18,12 +18,11 @@
|
||||||
<properties>
|
<properties>
|
||||||
|
|
||||||
<!-- Generic properties -->
|
<!-- Generic properties -->
|
||||||
<java.version>25</java.version>
|
<java.version>17</java.version>
|
||||||
<maven.compiler.release>17</maven.compiler.release>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<!-- Important for reproducible builds. Update using e.g. ./mvnw versions:set -DnewVersion=... -->
|
<!-- Important for reproducible builds. Update using e.g. ./mvnw versions:set -DnewVersion=... -->
|
||||||
<project.build.outputTimestamp>2025-11-22T16:15:42Z</project.build.outputTimestamp>
|
<project.build.outputTimestamp>2024-11-28T14:37:52Z</project.build.outputTimestamp>
|
||||||
|
|
||||||
<!-- Web dependencies -->
|
<!-- Web dependencies -->
|
||||||
<webjars-locator.version>1.1.2</webjars-locator.version>
|
<webjars-locator.version>1.1.2</webjars-locator.version>
|
||||||
|
|
@ -31,14 +30,13 @@
|
||||||
<webjars-font-awesome.version>4.7.0</webjars-font-awesome.version>
|
<webjars-font-awesome.version>4.7.0</webjars-font-awesome.version>
|
||||||
|
|
||||||
<checkstyle.version>12.1.2</checkstyle.version>
|
<checkstyle.version>12.1.2</checkstyle.version>
|
||||||
<error-prone.version>2.42.0</error-prone.version>
|
|
||||||
<jacoco.version>0.8.14</jacoco.version>
|
<jacoco.version>0.8.14</jacoco.version>
|
||||||
<libsass.version>0.3.4</libsass.version>
|
<libsass.version>0.3.4</libsass.version>
|
||||||
<lifecycle-mapping>1.0.0</lifecycle-mapping>
|
<lifecycle-mapping>1.0.0</lifecycle-mapping>
|
||||||
<maven-checkstyle.version>3.6.0</maven-checkstyle.version>
|
<maven-checkstyle.version>3.6.0</maven-checkstyle.version>
|
||||||
<nohttp-checkstyle.version>0.0.11</nohttp-checkstyle.version>
|
<nohttp-checkstyle.version>0.0.11</nohttp-checkstyle.version>
|
||||||
<nullaway.version>0.12.10</nullaway.version>
|
|
||||||
<spring-format.version>0.0.47</spring-format.version>
|
<spring-format.version>0.0.47</spring-format.version>
|
||||||
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
@ -57,7 +55,7 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-webmvc</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
|
@ -67,6 +65,16 @@
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-restclient</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Databases - Uses H2 by default -->
|
<!-- Databases - Uses H2 by default -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
@ -115,9 +123,8 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-devtools</artifactId>
|
<artifactId>spring-boot-devtools</artifactId>
|
||||||
<optional>true</optional>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-data-jpa-test</artifactId>
|
<artifactId>spring-boot-starter-data-jpa-test</artifactId>
|
||||||
|
|
@ -284,38 +291,6 @@
|
||||||
<failOnUnableToExtractRepoInfo>false</failOnUnableToExtractRepoInfo>
|
<failOnUnableToExtractRepoInfo>false</failOnUnableToExtractRepoInfo>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>default-compile</id>
|
|
||||||
<phase>compile</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>compile</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<compilerArgs>
|
|
||||||
<arg>-XDcompilePolicy=simple</arg>
|
|
||||||
<arg>--should-stop=ifError=FLOW</arg>
|
|
||||||
<arg>-Xplugin:ErrorProne -XepDisableAllChecks -Xep:NullAway:ERROR -XepOpt:NullAway:OnlyNullMarked=true -XepOpt:NullAway:CustomContractAnnotations=org.springframework.lang.Contract -XepOpt:NullAway:JSpecifyMode=true</arg>
|
|
||||||
</compilerArgs>
|
|
||||||
<annotationProcessorPaths>
|
|
||||||
<path>
|
|
||||||
<groupId>com.google.errorprone</groupId>
|
|
||||||
<artifactId>error_prone_core</artifactId>
|
|
||||||
<version>${error-prone.version}</version>
|
|
||||||
</path>
|
|
||||||
<path>
|
|
||||||
<groupId>com.uber.nullaway</groupId>
|
|
||||||
<artifactId>nullaway</artifactId>
|
|
||||||
<version>${nullaway.version}</version>
|
|
||||||
</path>
|
|
||||||
</annotationProcessorPaths>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
<!-- Spring Boot Actuator displays sbom-related information if a CycloneDX SBOM file is
|
<!-- Spring Boot Actuator displays sbom-related information if a CycloneDX SBOM file is
|
||||||
present at the classpath -->
|
present at the classpath -->
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue