Skip to content

Commit 95cd0a8

Browse files
Migrate from Java 8 to Java 11
- Update java.version from 1.8 to 11 in pom.xml - Upgrade Spring Boot from 2.0.2.RELEASE to 2.7.18 - Add maven-compiler-plugin 3.11.0 with release=11 - Add maven-surefire-plugin 3.1.2 for Java 11 module handling - Fix packaging from pom to jar for proper compilation - Update build.gradle: sourceCompatibility/targetCompatibility to 11, Spring Boot plugin to 2.7.18, compile->implementation syntax - Add GitHub Actions CI workflow for Java 11 - Update README prerequisites to specify Java 11 SDK Co-Authored-By: derek.wu <derekwu35@gmail.com>
1 parent c31d0c6 commit 95cd0a8

4 files changed

Lines changed: 46 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Java CI
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up JDK 11
17+
uses: actions/setup-java@v4
18+
with:
19+
java-version: '11'
20+
distribution: 'temurin'
21+
cache: maven
22+
23+
- name: Build with Maven
24+
run: mvn clean verify --batch-mode --no-transfer-progress

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ GET /datetime
7676

7777
### Prerequisites
7878

79-
1) Java sdk
79+
1) Java 11 SDK (or later)
8080
2) POSTMAN
8181

8282
### Installing

build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ buildscript {
33
mavenCentral()
44
}
55
dependencies {
6-
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.2.RELEASE")
6+
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.7.18")
77
}
88
}
99

@@ -22,11 +22,11 @@ repositories {
2222
mavenCentral()
2323
}
2424

25-
sourceCompatibility = 1.8
26-
targetCompatibility = 1.8
25+
sourceCompatibility = 11
26+
targetCompatibility = 11
2727

2828
dependencies {
29-
compile("org.springframework.boot:spring-boot-starter-web")
30-
testCompile("junit:junit")
29+
implementation("org.springframework.boot:spring-boot-starter-web")
30+
testImplementation("junit:junit")
3131
}
3232

pom.xml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55

66
<groupId>org.springframework</groupId>
77
<artifactId>gs-spring-boot</artifactId>
8-
<packaging>pom</packaging>
8+
<packaging>jar</packaging>
99
<version>0.1.0</version>
1010

1111
<parent>
1212
<groupId>org.springframework.boot</groupId>
1313
<artifactId>spring-boot-starter-parent</artifactId>
14-
<version>2.0.2.RELEASE</version>
14+
<version>2.7.18</version>
1515
</parent>
1616

1717
<dependencies>
@@ -35,12 +35,25 @@
3535
</dependencies>
3636

3737
<properties>
38-
<java.version>1.8</java.version>
38+
<java.version>11</java.version>
3939
</properties>
4040

4141

4242
<build>
4343
<plugins>
44+
<plugin>
45+
<groupId>org.apache.maven.plugins</groupId>
46+
<artifactId>maven-compiler-plugin</artifactId>
47+
<version>3.11.0</version>
48+
<configuration>
49+
<release>11</release>
50+
</configuration>
51+
</plugin>
52+
<plugin>
53+
<groupId>org.apache.maven.plugins</groupId>
54+
<artifactId>maven-surefire-plugin</artifactId>
55+
<version>3.1.2</version>
56+
</plugin>
4457
<plugin>
4558
<groupId>org.springframework.boot</groupId>
4659
<artifactId>spring-boot-maven-plugin</artifactId>

0 commit comments

Comments
 (0)