异步gradle复制任务? [英] Asynchronous gradle copy task?

查看:172
本文介绍了异步gradle复制任务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我创建了一个档案,说出一场战争,然后为了方便起见,我想另一个名称不同的副本。事情是我不希望这个复制任务减慢这个相当大的构建的其余部分。可以异步执行它?如果是这样,怎么样?

解决方案

  import java.util.concurrent。* 
...
def es = Executors.newSingleThreadExecutor()
...
war {
...
doLast {
es.submit( {
复制{
from destinationDir.absolutePath + File.separator +$ archiveName
到destinationDir
重命名为$ {archiveName},$ {baseName}。$ {扩展}

}
}作为可调用)
}
}


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?

解决方案

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

            }
        } as Callable)
    }
}

这篇关于异步gradle复制任务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆