Search code examples
javaosgibnd

bnd - Make resulted MANIFEST.MF to have one line per Bundle-ClassPath and RequireBundle entries


With OSGi tool bnd

If bnd.bnd file has

-buildpath: mod.base,\
    mod.common,\
    ...

those lines will be as one-liner, though wrapped at 72 potion. That make output harder to read.

Require-Bundle: mod.base,mod.common,...

How to tell bdn to make resulted MANIFEST.MF to have one line per Bundle-ClassPath and RequireBundle entries


Solution

  • As much as I saw in the source of bnd, it creates a java.util.jar.Manifest object. Serializing the content to disk is made with ManifestUtil, because of some limitation with the output of the Manifest class provided by Java.

    I use an online tool when when I want to read the OSGi headers: https://robinst.github.io/jar-manifest-formatter/

    Although this does not format Require-Bundle, Provide-Capability and Require-Capability headers, I think it should not take more than 10 minutes for you to change the javascript file to format those, too. If you do that, I suggest that you should send a PR for robinst ;).

    UPDATE: It can already, thanks to Robin