How to execute a gradle external task (Exec) in background?

Could some one help to answer my question post in Stackoverflow?

PS, i’m using latest gradle.

You can use the Gradle Spawn plugin: https://github.com/marcoVermeulen/gradle-spawn-plugin