Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 746
dna Avatar asked Feb 25 '16 22:02

dna


1 Answers

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:

  • class files in /var/task/
  • libraries in /var/task/lib
  • properties and other config files in /var/task/resources

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.

like image 146
cahilltr Avatar answered Sep 18 '22 14:09

cahilltr