1
0

More than 3 years have passed since last update.

GradleでJavaのコンパイルオプションを設定する方法

Posted at

概要

Javaではコンパイル時にコンパイルオプションというものがあり、classファイルの出力ディレクトリやデバッグ情報を含めるかなどを設定できます。普通にjavacコマンドで行う場合はコマンドにオプションをつければ良いのですが、Gradleでビルドしている場合はどこに設定すれば良いのか、今回書きます。

設定方法

こちらのstackoverflowの記事にある通り、pluginにjavaを設定しoptions.compilerArgs項目にオプションを設定します。

設定サンプル

上記の記事そのままですが、設定内容のサンプルを記載します。-parametersオプションの設定を行うときの設定です。

build.gradle
apply plugin: 'java'

compileJava {
    options.compilerArgs << '-parameters' 
}
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