LoginSignup
1
1

CheckStyleをGradleに導入+文字化け対応

Posted at

環境

  • windows10
  • gradle 8.2.1
  • CheckStyle 10.12.2

CheckStyle Pluginの設定

build.gradle
plugins {
    id 'checkstyle'
}

checkstyle {
    // 使用するCheckstyleのバージョン
    toolVersion = '10.12.2'

    // 定義ファイル
    configFile = file("${rootDir}/config/checkstyle/google_checks.xml")

    // Checkstyleによる警告が出た場合もビルドを継続するか?
    ignoreFailures = false

    // ビルドを中断または失敗プロパティを設定する前に許容される警告の最大数
    maxWarnings = 0
}

google_checks.xmlはgithubからダウンロードした

文字化け対応

CheckStyleを実行して文字化けした場合、gradle.propertiesを作成して書きを設定する

gradle.properties
# Gradle実行時のjvm引数
# チェック失敗時のエラーメッセージが文字化けするため設定を追加
org.gradle.jvmargs = -Dfile.encoding=UTF-8
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1