Printing MANIFESTs of all .jar files in a folder

Use case

I recenlty OSGified an open source library using bnd-maven-plugin to add OSGi meta data. It was a multi-module maven project resulting in one .jar file per module. I wanted to quickly view all MANIFEST.MF files of all jars in a text file.

Turns out the bnd print command of the bnd CLI can help.

Examples

E.g. for a maven folder layout, run this in the root of your project:

bnd print -m  */target/*.jar > allmanifests.txt

Or this if you have the usual bnd workspace layout with a generated folder, containing the jar of your bundle:

bnd print -m  */generated/*.jar > allmanifests.txt

This writes all MANIFEST.MF entries to a allmanifests.txt for examination.

I also suggest adding the `-v --verify` option to also verify the bundle’s correctness.

1 Like