[英]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被反汇编时,它的文件被提取如下:
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.