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, ...
I want my lambda to log that information and/or have it as a part of its output.
In most cases, I can access this with code similar to: {code}GreatestClassNameEver.class.getPackage().getImplementationVersion(){code}
I tried this with my lambda, but {code}getImplementationVersion(){code} returns null.
After creating an AWS support ticket, it turns out that this isn't possible due to how Lambda extracts the Jar.
When the jar is disassembled it's files are extracted as follows:
but the META-INF directory is not extracted during this process.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With