dna
dna

Reputation: 519

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.

Upvotes: 8

Views: 942

Answers (1)

cahilltr
cahilltr

Reputation: 128

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.

Upvotes: 5

Related Questions