I want to have English messages when compiling.
Following this post and this, I added the following to my build.gradle
compileJava {
options.compilerArgs << '-J-Duser.language=en'
options.fork = true
options.forkOptions.executable = 'javac'
}
But I get ([] is my translation, not official)
javac: 无效的标记[invalid flags]: -J-Duser.language=en
用法[usage]: javac <options> <source files>
-help 用于列出可能的选项[for possible options]
In cmd
, a simple javac -J-Duser.language=en
do gives me English messages.
My question:
javac
command used when compiling?Instead of using -J
, passing the flag to options.forkOptions.jvmArgs
should work:
tasks.withType(JavaCompile) {
options.fork = true
options.forkOptions.jvmArgs += ["-Duser.language=en"]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With