From ee52adf24c95f4e1d7580c84ff2cd8c139f7db71 Mon Sep 17 00:00:00 2001 From: John Niang Date: Sun, 12 Nov 2023 12:30:08 +0800 Subject: [PATCH] Fix the problem where some Windows developers are unable to build project (#4844) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /kind bug /area core #### What this PR does / why we need it: Currently, some Windows developers using GBK as character encoding are unable to build project, please see https://github.com/halo-dev/halo/issues/4771 for more. Because the source code are using UTF-8 character encoding, the `javadoc`, `compileJava`, `compileTestJava` and `delombok` tasks will use the default character encoding GBK to handle the sources, which prevents the `:api:javadoc` task from running properly. At the same time, we thank to @DaiYuANg for his first proposed solution in https://github.com/halo-dev/halo/pull/4517. #### Which issue(s) this PR fixes: Fixes https://github.com/halo-dev/halo/issues/4771 #### Special notes for your reviewer: Validate the result by executing command `./gradlew clean build -x check` on Windows environment. #### Does this PR introduce a user-facing change? ```release-note 修复在部分 Windows 开发者无法正常构建 Halo 的问题 ``` --- api/build.gradle | 4 ++++ application/build.gradle | 2 ++ 2 files changed, 6 insertions(+) diff --git a/api/build.gradle b/api/build.gradle index 4e8a5c6cd0..7063a3c601 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -7,6 +7,10 @@ plugins { group = 'run.halo.app' description = 'API of halo project, connecting by other projects.' +compileJava.options.encoding = "UTF-8" +compileTestJava.options.encoding = "UTF-8" +javadoc.options.encoding = "UTF-8" + repositories { mavenCentral() maven { url 'https://repo.spring.io/milestone' } diff --git a/application/build.gradle b/application/build.gradle index 71baa80605..988b82a3cd 100644 --- a/application/build.gradle +++ b/application/build.gradle @@ -11,6 +11,8 @@ plugins { group = "run.halo.app" sourceCompatibility = JavaVersion.VERSION_17 +compileJava.options.encoding = "UTF-8" +compileTestJava.options.encoding = "UTF-8" checkstyle { toolVersion = "9.3"