Skip to content

Commit

Permalink
Set source and target compatibility to Java 17 (#5499)
Browse files Browse the repository at this point in the history
#### What type of PR is this?

/kind chore
/area core

#### What this PR does / why we need it:

I get the following errors when I develop Halo in JDK 21:

```bash
FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':application:bootRun'.
> Could not resolve all dependencies for configuration ':application:runtimeClasspath'.
   > Failed to calculate the value of task ':application:compileJava' property 'javaCompiler'.
      > No matching toolchains found for requested specification: {languageVersion=17, vendor=any, implementation=vendor-specific} for MAC_OS on aarch64.
         > No locally installed toolchains match and toolchain download repositories have not been configured.
```

This PR removes the Java toolchain configuration and adds source and target compatibility to Java 17, allowing developers to develop Halo in Java 17 or higher versions.

#### Does this PR introduce a user-facing change?

```release-note
None
```
  • Loading branch information
JohnNiang committed Mar 12, 2024
1 parent ed23914 commit 956f4ef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions api/build.gradle
Expand Up @@ -8,6 +8,11 @@ plugins {
group = 'run.halo.app'
description = 'API of halo project, connecting by other projects.'

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

compileJava.options.encoding = "UTF-8"
compileTestJava.options.encoding = "UTF-8"
javadoc.options.encoding = "UTF-8"
Expand Down
5 changes: 2 additions & 3 deletions application/build.gradle
Expand Up @@ -18,9 +18,8 @@ compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = 'UTF-8'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

checkstyle {
Expand Down

0 comments on commit 956f4ef

Please sign in to comment.