执行jar命令排除文件 [英] Execute jar command exclude files
问题描述
我按照 Java Archive Tool 进行操作但是找不到如何排除文件夹。
I followed The Java Archive Tool but couldn't find how to exclude folders.
例如,我有工作副本目录下的文件:
For example, I have the files under working copy directory:
workingcopy
--src
--.svn
-- com
--.svn
--WebContent
我想从 src下的类中编译和创建jar
排除以.svn目录开头的所有文件夹。我想从 cmd
运行它,比如 jar -cf test.jar
等等。
I would like to compile and create jar only from the classes under src
excluding all folders starting with .svn directory. I want to run it from cmd
like jar -cf test.jar
etc..
我该怎么做?
推荐答案
这可能是解决问题的实用方法:它不会排除 subversion目录(目录),但只包含类文件(假设,不将类文件置于版本控制之下):
This could be a practical workaround for your problem: it will not exclude the subversion directory (directories) but include only class files (assuming, you don't put class files under version control):
jar -cf test.jar *.class
进一步增强:从类文件中分离代码。您无论如何都不想签入类文件(构建工件):
Further enhancement: separate code from class files. You don't want to check in class files (build artefacts) anyway:
workingcopy
--src
--.svn
-- com // only *.java files in here and below
--.svn
--WebContent
--bin
--com // only *.class files in here and below
这篇关于执行jar命令排除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!