开发者

Making a JAR file which includes all files of a cetain type from any subdirectory

开发者 https://www.devze.com 2023-03-19 23:23 出处:网络
So this is a simplified version of my package structure Project 1 -folder1 -folder2 -folder21 -folder211

So this is a simplified version of my package structure

 Project 1
 -folder1
 -folder2
  -folder21
   -folder211
    -test3.java
  -folder22
 -folder3
  -test4.java

-Project2
 -folder1
  -folder11
   -folder111
     -Test.java
 -folder2
  -.properties
  -Test2.java
 -folder3

What I want to find is command that will create a jar and take the paths to project1 and project2 and recursively add the folder structure and java files without adding the .properties files.

What i've tried so far is jar cvf test.jar "pathtoproject1/.java" "pathtoproject2/.java" That only works for java files in the base project directories not the s开发者_如何学运维ubfolders. Anyone know how to do this?

edit This is for a batch script on windows


Frankly I'm not sure that jar handles this out of the box.

I suggest using ant - with an ant jar task, using a fileset.

0

精彩评论

暂无评论...
验证码 换一张
取 消