使用 Windows 批处理创建 war 文件并在没有 Maven ant 等的情况下排除特定目录

Create war file with Windows batch and exclude specific directory without maven ant etc

我在 windows 尝试创建 .war 文件并从该文件中排除某些目录时遇到一些问题。

jar -cvf test.war .

这是创建 .war 文件的更基本方法,但我找不到任何方法来正确过滤目录,而不必将每个目录列入白名单。

jar -cvf test.war images

这只会将图像目录添加到我的文件中,但这不是我想要的处理方式。

我不想使用像 AntMaven

这样的东西

一切都应该 运行 从 Windows 命令提示符 使用 Batch。

感谢您的任何回复,祝您有愉快的一天!

我放弃了这样做,现在我使用白名单来添加文件/目录

批次看起来像:

set whitelist=
for /f "tokens=*" %%a in (whitelist.txt) do set whitelist=!whitelist!%%a 
jar -cvf test.war %whitelist%

白名单看起来像:

html
images
*.xml