提取/查看.war文件中特定文件的内容 [英] Extract/See content of a specific file inside a .war file

查看:78
本文介绍了提取/查看.war文件中特定文件的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图查看.war文件中的文件内容(在Linux中),而不必提取war文件.例如,在war文件中,我试图查看aa.txt文件的内容,该文件位于war文件中的/path/here/下.

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.

推荐答案

jar 具有 x 选项:

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

让我们尝试一下:

$ 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

这篇关于提取/查看.war文件中特定文件的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆