本文介绍了Gradle Sync任务,同步到文件夹但忽略目标中的指定目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将驱动器上的文件夹与另一个包含名为'logs'的文件夹保持同步。困惑?这里有一个图表:

I want to synchronize a folder on my drive with another folder that contains a folder named 'logs' that i want to keep. confused? here's a diagram:

C:\
|-- mydir/ # sync this folder
|   `-- someotherfiles.txt
`-- anotherDir/ # into this folder
    |-- logs/ # but if this exists, leave it there
    `-- someotherfiles.txt

这是否可以使用同步任务?我似乎无法正确配置它,我最近的尝试可能暗示你对我的情况,所以它在这里(不工作):

Is this possible using the sync task? I can't seem to configure it properly, my latest attempt might allude you to my scenario so here it is (not working):

task syncDevDeployFolder(type: Sync, group: 'dev') {
    from currentDeliverablesDir
    destinationDir = file(project.properties['dev.deployment.dir'])
    into (project.properties['dev.deployment.dir']) {
        exclude "logs"
    }
}

$

推荐答案

不, Sync 任务目前不支持此功能。

No, the Sync task doesn't currently support this.

这篇关于Gradle Sync任务,同步到文件夹但忽略目标中的指定目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 20:37