user447607 user447607 - 1 year ago 172
Groovy Question

Asynchronous gradle copy task?

So I create an archive, say a war, and then I want another copy with a different name for convenience. Thing is that I don't want that copy task to slow down the rest of this rather large build. Possible to execute it asynchronously? If so, how?

Answer Source
import java.util.concurrent.*
def es = Executors.newSingleThreadExecutor()
war {
            copy {
                from destinationDir.absolutePath + File.separator + "$archiveName"
                into destinationDir
                rename "${archiveName}", "${baseName}.${extension}"

        } as Callable)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download