Skip to content

Commit 88cc3a3

Browse files
committed
Fix Gradle 9 compatibility and upgrade to Java 17
- Move sourceCompatibility/targetCompatibility into java {} block (required by Gradle 9) - Replace deprecated JavaExec.main with mainClass.set() - Bump google-java-format from 1.8 to 1.22.0 (Java 17 compat) - Update pom.xml java.version from 1.8 to 17
1 parent 417400b commit 88cc3a3

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

build.gradle

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,10 @@ if(hasProperty('target') && target == 'android') {
8383
apply plugin: 'java'
8484
apply plugin: 'maven-publish'
8585

86-
sourceCompatibility = JavaVersion.VERSION_1_8
87-
targetCompatibility = JavaVersion.VERSION_1_8
86+
java {
87+
sourceCompatibility = JavaVersion.VERSION_17
88+
targetCompatibility = JavaVersion.VERSION_17
89+
}
8890

8991
publishing {
9092
publications {
@@ -96,7 +98,7 @@ if(hasProperty('target') && target == 'android') {
9698
}
9799

98100
task execute(type:JavaExec) {
99-
main = System.getProperty('mainClass')
101+
mainClass.set(System.getProperty('mainClass'))
100102
classpath = sourceSets.main.runtimeClasspath
101103
}
102104
}
@@ -146,7 +148,7 @@ spotless {
146148
// don't need to set target, it is inferred from java
147149

148150
// apply a specific flavor of google-java-format
149-
googleJavaFormat('1.8').aosp().reflowLongStrings()
151+
googleJavaFormat('1.22.0').aosp().reflowLongStrings()
150152

151153
removeUnusedImports()
152154
importOrder()

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@
338338
</dependency>
339339
</dependencies>
340340
<properties>
341-
<java.version>1.8</java.version>
341+
<java.version>17</java.version>
342342
<maven.compiler.source>${java.version}</maven.compiler.source>
343343
<maven.compiler.target>${java.version}</maven.compiler.target>
344344
<gson-fire-version>1.9.0</gson-fire-version>

0 commit comments

Comments
 (0)