简体   繁体   English

如何在战争中添加清单文件

[英]How to add manifest file in war

I am able to create war file of the dir specified ie /mydir with 我能够创建指定目录的战争文件,即/ mydir与

Process p = Runtime.getRuntime().exec("jar -cvf myapp.war . ",
                        s,
                        new File("/mydir"));

but when i try to add manifest file while creating , the war file created is currupted 但是当我尝试在创建时添加清单文件时,创建的战争文件损坏了

Process p = Runtime.getRuntime().exec("jar -cvfm myapp.war MANIFEST.MF . ",
                        s,
                        new File("/mydir"));

Even I tried this , it create war but only contains manifest file and not the content of /mydir 即使我尝试过,它也会产生战争,但仅包含清单文件,而不包含/ mydir的内容

Process p = Runtime.getRuntime().exec("jar -cvfm myapp.war MANIFEST.MF * ",
                        s,
                        new File("/mydir"));

I have used below snippet and its working fine 我已经使用了以下代码段及其正常工作

jar -cvfM  myapp.war MANIFEST.MF * ",
                        s,
                        new File("/mydir"));

Which means it will not add manifest autogenerated one rather than it archives the one(customized manifest file) which I have kept in meta-inf folder 这意味着它将不添加清单自动生成的清单,而是将我保存在meta-inf文件夹中的清单(自定义清单文件)存档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM