[英]How to exclude certain files while creating war file using jar command?
I am using command jar cvf MyWarFile.war <list all files and dir to be part of war file with space in between>
to create a war file in linux. 我正在使用命令jar cvf MyWarFile.war <list all files and dir to be part of war file with space in between>
在Linux中创建war文件。 I don't want to specify each and every file/dir in the command rather I just want to use * (to create war file out of files in current dir) . 我不想在命令中指定每个文件/目录,而只想使用*(从当前目录中的文件中创建war文件)。 What should I do to exclude certain file/dir while trying add all the files (using *) in the directory to the war file that i am creating. 在尝试将目录中的所有文件(使用*)添加到我正在创建的war文件中时,我应该怎么做才能排除某些文件/目录。
I am looking for something like 我正在寻找类似的东西
jar cvf MyWarFile.war * <how to exclude certain file/dir>
You can use wildcard !
您可以使用通配符!
and parenthesis to create your war
file. 和括号来创建您的war
文件。 Anything written inside parenthesis will be excluded 括号内的所有内容均不包括在内
jar cvf MyWarFile.war !(file1)
If you want to exclude multiple files from jar
file/folder selection you can use |
如果要从jar
文件/文件夹选择中排除多个文件,则可以使用|
. 。
jar cvf MyWarFile.war !(file1|folder1)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.