LoginSignup
1
0

More than 1 year has passed since last update.

Gradleでコンパイル警告を100件より多く表示する

Posted at

背景

コンパイル警告があまりに多いプロジェクトだと、最初の100件までしか警告内容が出力されない。そもそもコンパイル警告が多い状態で放置していること自体が問題だが、途中で省略させずにすべてを確認したいこともある。

$ ./gradlew clean build
Starting a Gradle Daemon (subsequent builds will be faster)
...
ノート:一部の入力ファイルは推奨されないAPIを追加使用またはオーバーライドしています。
ノート:入力ファイルの操作のうち、未チェックまたは安全ではないものがあります。
ノート:詳細は、-Xlint:uncheckedオプションを指定して再コンパイルしてください。
警告100個

対応方法

-Xmaxwarns の値としてすごく大きな値を指定してやることで回避することができる。

    compileJava {
        sourceCompatibility = 17
        targetCompatibility = 17
        options.deprecation = true
        options.compilerArgs << "-Xmaxwarns" << "1000"
    }

確認環境

  • OpenJDK 17.0.1
  • Gradle 7.3.1
1
0
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
0