简体   繁体   English

Aws Lambda访问META-INF / MANIFEST.MF?

[英]Aws Lambda access to META-INF/MANIFEST.MF?

I'm in the habit of filling in the META-INF/MANIFEST.MF of every jar file I build with information related to the version of the component, build time, ... 我习惯填写我构建的每个jar文件的META-INF / MANIFEST.MF,其中包含与组件版本,构建时间相关的信息,...

I want my lambda to log that information and/or have it as a part of its output. 我希望我的lambda记录该信息和/或将其作为其输出的一部分。

In most cases, I can access this with code similar to: {code}GreatestClassNameEver.class.getPackage().getImplementationVersion(){code} 在大多数情况下,我可以使用类似于以下代码访问它:{code} GreatestClassNameEver.class.getPackage()。getImplementationVersion(){code}

I tried this with my lambda, but {code}getImplementationVersion(){code} returns null. 我用我的lambda尝试了这个,但{code} getImplementationVersion(){code}返回null。

After creating an AWS support ticket, it turns out that this isn't possible due to how Lambda extracts the Jar. 创建AWS支持票证后,由于Lambda如何提取Jar,因此无法做到这一点。

When the jar is disassembled it's files are extracted as follows: 当jar被反汇编时,它的文件被提取如下:

  • class files in /var/task/ / var / task /中的类文件
  • libraries in /var/task/lib / var / task / lib中的库
  • properties and other config files in /var/task/resources / var / task / resources中的属性和其他配置文件

but the META-INF directory is not extracted during this process. 但在此过程中未提取META-INF目录。

The workaround they gave me was to use a plugin to copy the manifest to the Resources directory and read from the /var/task/resources/... to get the information you need. 他们给我的解决方法是使用插件将清单复制到Resources目录,并从/var/task/resources/...读取以获取所需的信息。

暂无
暂无

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

相关问题 META-INF / MANIFEST.MF文件中的库依赖关系 - library dependencies in META-INF/MANIFEST.MF file 如何从* .war / META-INF / MANIFEST.MF文件中读取manifest.mf? - How to read manifest.mf from *.war/META-INF/MANIFEST.MF file? 为什么喜欢/ WEB-INF / lib到/META-INF/MANIFEST.MF用于webapps? - Why prefer /WEB-INF/lib to /META-INF/MANIFEST.MF for webapps? 提取和重新创建的jar不支持“ META-INF / MANIFEST.MF”中的清单。 - Extracted and recreated jar does not honor manifest at `META-INF/MANIFEST.MF` 如何在Spring Boot应用程序中读取我的META-INF / MANIFEST.MF文件? - How to read my META-INF/MANIFEST.MF file in a Spring Boot app? jar文件中缺少主要属性,MANIFEST.MF文件位于META-INF文件夹中 - Missing main attribute inside the jar file, the MANIFEST.MF file is located in META-INF folder 对于 JIMAGE 文件,什么相当于 JAR 文件 META-INF/MANIFEST.MF? - What is the equivalent to JAR file META-INF/MANIFEST.MF for a JIMAGE file? 在unnamed.war中找不到META-INF / MANIFEST.MF文件 - META-INF/MANIFEST.MF file not found in unnamed.war 为什么不能使用maven-war-plugin将密钥与“ WEB-INF / classes / META-INF / MANIFEST.MF”合并? - Why keys are not merged with “WEB-INF/classes/META-INF/MANIFEST.MF” using maven-war-plugin? Java - 即使 MANIFEST.MF 文件位于 /META-INF 中,App.jar 中也没有主要清单属性 - Java - No Main Manifest Attribute, in App.jar error even though MANIFEST.MF file is in /META-INF
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM