How should I set encoding for java compile

This

tasks.withType(Compile) {

options.encoding = ‘ISO-8859-1’ }

works but is deprecated. What is the current recommended method(s). Also is the default encoding that of the platform on which gradle is run?

Replace ‘Compile’ with ‘JavaCompile’. Yes, platform encoding is the default.