且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Ant的tar任务即使在其他平台上使用该任务也可以设置Linux文件权限吗?

更新时间:2022-06-21 09:54:32

是的,您可以使用 tarfileset,使用 filemodedirmode 属性.这适用于创建 tar 存档,即使在 Windows 上也是如此.

Yes, you can set permissions using tarfileset, using the filemode and dirmode attributes. This works when creating tar archives, even on windows.

尽管很烦人,解压任务没有 支持您可能想要的反向操作:

Rather annoyingly though, the untar task does not support the reverse operation that you might want:

文件权限不会恢复关于提取的文件.

File permissions will not be restored on extracted files.

但是,例如,如果您使用 tar -xf,权限会恢复正常.

But the permisions are restored fine if you use tar -xf, for example.