I want to set the -parameters command on my gradle build so that I can use reflection to access the name of the parameters. It seems like I should be doing this with the fol
Please try:
apply plugin: 'java'
compileJava {
options.compilerArgs << '-parameters'
}
You can work with Compile Options in App.gradle file like this:
android {
compileSdkVersion 28
buildToolsVersion "28.0.2"
defaultConfig {
applicationId "com.example.aliazaz.menuapp"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
/*Add Compile options in following block*/
compileOptions {
//Like these
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
You cannot overwrite all of the options (since 'options' property is read-only), but you can set them one by one. For example:
compileJava {
//enable compilation in a separate daemon process
options.fork = true
//enable incremental compilation
options.incremental = true
}
Check out the docs: https://gradle.org/docs/current/dsl/org.gradle.api.tasks.compile.JavaCompile.html and https://gradle.org/docs/current/dsl/org.gradle.api.tasks.compile.CompileOptions.html
tasks.withType(JavaCompile) {
configure(options) {
options.compilerArgs << '-Xlint:deprecation' << '-Xlint:unchecked' // examples
}
}
Source: http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.compile.CompileOptions.html