Google Java Formatter as external application

Don’t mean to sidetrack you, but it might be easier to accomplish this using the spotless plugin, which formats code using the Eclipse formatter.

plugins {
    id 'com.diffplug.gradle.spotless' version '2.0.0'
}

spotless {
    java {
        eclipseFormatFile 'googlestyle.xml'
    }
}

Google maintains an eclipse formatter for their style.