Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gradle processResources每个文件删除空目录_Gradle_Directory_Copy_Rename - Fatal编程技术网

Gradle processResources每个文件删除空目录

Gradle processResources每个文件删除空目录,gradle,directory,copy,rename,Gradle,Directory,Copy,Rename,为每个文件添加不同的前缀: src/main/resources/foo/bar/a.xml hello/world/b.xml 问题是:原始目录包含在jar中 processResources { eachFile {details -> if (details.path.starts("foo/")) details.path = "prefix1/" + details.path e

为每个文件添加不同的前缀:

src/main/resources/foo/bar/a.xml
                   hello/world/b.xml
问题是:原始目录包含在jar中

processResources {
    eachFile {details ->

       if (details.path.starts("foo/")) 
           details.path = "prefix1/" + details.path
       else
           details.path = "prefix2/" + details.path
    }
}
似乎每个文件都会迭代不包括目录的文件

将processResources上的includeEmptyDirs设置为false

foo/
foo/bar
hello/
hello/world