Skip to content

Commit c416ccf

Browse files
committed
Fix Gradle 9 compatibility issues
- Move sourceCompatibility and encoding settings into java {} block - Use JavaVersion.VERSION_1_7 instead of numeric value - Consolidate Java configuration in java {} block - Fixes 'Could not set unknown property sourceCompatibility' error in Gradle 9
1 parent bbef71c commit c416ccf

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

build.gradle

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ dependencies {
3131
}
3232
}
3333

34-
sourceCompatibility = 1.7
35-
compileJava.options.encoding = 'UTF-8'
36-
javadoc.options.encoding = 'UTF-8'
37-
3834
sourceSets {
3935
main {
4036
java {
@@ -115,8 +111,15 @@ jar {
115111
}
116112

117113
java {
114+
sourceCompatibility = JavaVersion.VERSION_1_7
115+
targetCompatibility = JavaVersion.VERSION_1_7
116+
118117
withJavadocJar()
119118
withSourcesJar()
119+
120+
// Configure encoding
121+
compileJava.options.encoding = 'UTF-8'
122+
javadoc.options.encoding = 'UTF-8'
120123
}
121124

122125
sourcesJar {

0 commit comments

Comments
 (0)