如何使用 Bash 从 JAR 读取 MANIFEST.MF 文件 [英] How to read MANIFEST.MF file from JAR using Bash

查看:24
本文介绍了如何使用 Bash 从 JAR 读取 MANIFEST.MF 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用 bash 从some.jar"读取 MANIFEST.MF maven 清单文件

I need to read MANIFEST.MF maven manifest file from "some.jar" using bash

推荐答案

$ unzip -q -c myarchive.jar META-INF/MANIFEST.MF

  • -q 将抑制解压程序的详细输出
  • -c 将提取到标准输出
    • -q will suppress verbose output from the unzip program
    • -c will extract to stdout
    • 示例:

      $ 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.

      Alternatively you can use -p instead of -q -c.

      -p 将文件提取到管道 (stdout).除了文件数据之外什么都不会发送到标准输出,并且文件总是以二进制格式提取,就像它们被存储一样(没有转换).

      -p extract files to pipe (stdout). Nothing but the file data is sent to stdout, and the files are always extracted in binary format, just as they are stored (no conversions).

      这篇关于如何使用 Bash 从 JAR 读取 MANIFEST.MF 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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