Generally, the approach is: 1. Use a `doFirst` block to write an options file. 2. Use `JavaExec` instead of `MlcpTask` if you don't want host/username/password to be set automatically. 3. Use a `doLast` block to delete the file if necessary.