Rom*_*nko 2 symlink build gradle
以下 gradle 任务复制目录但解析所有符号链接。这是无法接受的。我想保存。
task test {
doLast {
copy {
from 'source'
to 'destination'
}
}
}
Run Code Online (Sandbox Code Playgroud)
对此我们能做些什么呢?
该“错误”有一个未解决的问题
现在您可以检测符号链接,也许可以手动创建它
import java.nio.file.FileSystems
import java.nio.file.Files
import java.nio.file.Path
copy {
from $source
into $destination
eachFile { details ->
Path pathFile = FileSystems.getDefault().getPath(details.file.path)
if(Files.isSymbolicLink(pathFile)) {
details.exclude()
commandLine 'ln', '-s', Files.readSymbolicLink(pathFile), "$destination/${details.relativePath}
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2223 次 |
| 最近记录: |