Percy

如何使用Bash从JAR读取MANIFEST.MF文件

java

我需要使用bash从“ some.jar”中读取MANIFEST.MF Maven清单文件


阅读 438

收藏
2020-12-08

共1个答案

小编典典

$ unzip -q -c myarchive.jar META-INF/MANIFEST.MF
  • -q 将取消解压缩程序的详细输出
  • -c将提取到标准输出
    例:
$ unzip -q -c commons-lang-2.4.jar META-INF/MANIFEST.MF

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: 1.5.0_13-119 (Apple Inc.)
Package: org.apache.commons.lang
Extension-Name: commons-lang
Specification-Version: 2.4
Specification-Vendor: Apache Software Foundation
Specification-Title: Commons Lang
Implementation-Version: 2.4
Implementation-Vendor: Apache Software Foundation
Implementation-Title: Commons Lang
Implementation-Vendor-Id: org.apache
X-Compile-Source-JDK: 1.3
X-Compile-Target-JDK: 1.2

或者,您可以使用-p代替-q -c

-p将文件提取到管道(stdout)。除了文件数据外,什么都没有发送到stdout,并且文件总是以二进制格式提取,就像存储文件一样(不进行转换)。

2020-12-08