How to print javac compiling command when executing gradle build

Hi,

I am using gradle to build Android apk files. When I run the command ‘./gradlew assembleRelease’, I would like to print the real javac compiling command in the stdout to see how java files are compiled into class files
.
Could anyone give some hint? Thank you in advance.

-Leo

1 Like

Something like

tasks.withType(JavaCompile) {
   doFirst {
      println "Args for for $name are $options.allCompilerArgs"
   }
} 

See https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/compile/CompileOptions.html

I am trying to do the same thing.

Unfortunately for me the snippet is printing:

Args for for compileJava are []

Edit: I also noticed that Bazel has a print_action command - is there any similar feature built into gradle?

Perhaps this is not possible: https://stackoverflow.com/a/45253607