Extract/See content of a specific file inside a .war file

ぐ巨炮叔叔 提交于 2019-12-08 11:54:16

问题


I am trying to view the content of a file ( in linux )that is inside a .war file without having to extract the war file. For example inside the war file i am trying to see the content of a file called aa.txt and which is under /path/here/ inside the war file.


回答1:


jar has x option for that:

$ jar -help 2>&1 | grep extract
    -x  extract named (or all) files from archive

Let's try it:

$ jar tvf target/my.war | grep test-data
  1811 Tue Jun 21 19:34:50 CEST 2016 WEB-INF/classes/test/spring/test-data.properties
$ jar xvf target/my.war WEB-INF/classes/test/spring/test-data.properties
 inflated: WEB-INF/classes/test/spring/test-data.properties
$ ls -l WEB-INF/classes/test/spring/test-data.properties
-rw-rw-r--. 1 coder coder 1811 Jun 21 19:34 WEB-INF/classes/test/spring/test-data.properties


来源:https://stackoverflow.com/questions/37972850/extract-see-content-of-a-specific-file-inside-a-war-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!