NetBeans ANT:不包括隐藏文件吗?

发布于 2025-01-06 05:01:49 字数 670 浏览 5 评论 0原文

在清理/构建结束时,我希望始终自动将项目文件夹复制到 zip 中以便于传输。因此,我将其添加到 build.xml 中的构建后 中:

<zip zipfile="../project-xyz.zip" basedir=".." includes="project-xyz/**" excludes="*/dir/lib/**"/>

这在 Windows 上效果很好,但在 Linux 上,它会删除任何 .hidden< /code> 文件夹及其所有子文件夹。我什至尝试过

<zip zipfile="../project-xyz.zip" basedir=".." includes="project-xyz/**,project-xyz/.hidden/**" excludes="*/dir/lib/**"/>

,但仍然不起作用。

我该怎么做才能将这些文件放入 zip 中?

我不反对检测非 Windows 环境并在 zip 命令上使用 ,尽管我不确定如何做到这一点,而且我也不反对当然我真的很想,特别是如果有更好的方法的话!

At the end of my Clean/Build, I wanted to always automatically copy the project folder into a zip for easy transfer. So I added this to my post build <target> in build.xml:

<zip zipfile="../project-xyz.zip" basedir=".." includes="project-xyz/**" excludes="*/dir/lib/**"/>

This works great on Windows, but on Linux, it removes any .hidden folders and all their children. I even tried

<zip zipfile="../project-xyz.zip" basedir=".." includes="project-xyz/**,project-xyz/.hidden/**" excludes="*/dir/lib/**"/>

and it still doesn't work.

What can I do to bring those files into the zip?

I am not opposed to detecting non-Windows environments and using <exec> on the zip command, though I am not sure how I would do that, and I am not sure I really want to, especially if there is a better way!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

倒带 2025-01-13 05:01:49

您可以通过在 ant 中添加以下行来查看默认情况下从 zip 中排除的内容

<defaultexcludes echo="true"/>

,然后使用

<defaultexcludes add=.../>

<defaultexcludes remove=.../>

自定义默认情况下排除的内容。

参考:Ant 文档用于 DefaultExcludes

编辑

您也可以参考

<zip defaultexcludes="no" .../>

Zip 的 Ant 文档

You can see what gets excluded by default from the zip by adding the following line in ant

<defaultexcludes echo="true"/>

And then use

<defaultexcludes add=.../>

and

<defaultexcludes remove=.../>

to customize what gets excluded by default.

Reference: Ant docs for DefaultExcludes

EDIT

You can also do

<zip defaultexcludes="no" .../>

Reference: Ant docs for Zip

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文