简体   繁体   English

bnd-使生成的MANIFEST.MF每个Bundle-ClassPath和RequireBundle条目具有一行

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

With OSGi tool bnd 使用OSGi工具bnd

If bnd.bnd file has 如果bnd.bnd文件包含

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

those lines will be as one-liner, though wrapped at 72 potion. 这些线将是单线的,尽管以72药水包裹。 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 如何告诉bdn生成结果MANIFEST.MF,每个Bundle-ClassPath和RequireBundle条目只有一行

The MANIFEST.MF format is defined by the Jar File Specification and it is not intended to be particularly human-readable. MANIFEST.MF格式是由Jar文件规范定义的,并不特别易于人阅读。

You can format the manifest of any bundle using the bnd command. 您可以使用bnd命令格式化任何捆绑软件的清单。 From the command line: 在命令行中:

bnd print <filename.jar>

This will print the imports and exports, as well as the uses constraints, in a nice layout. 这将以一个不错的布局打印进出口以及使用限制。

By the way... don't use Require-Bundle . 顺便说一句...不要使用Require-Bundle

As much as I saw in the source of bnd, it creates a java.util.jar.Manifest object. 正如我在bnd的源代码中看到的那样,它创建了一个java.util.jar.Manifest对象。 The format of the output is based on the code of the Manifest class provided by Java. 输出的格式基于Java提供的Manifest类的代码。

I use an online tool when when I want to read the OSGi headers: https://robinst.github.io/jar-manifest-formatter/ 当我想阅读OSGi标头时,可以使用在线工具: 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. 虽然这不会格式化Require-Bundle,Provide-Capability和Require-Capability标头,但我认为更改javascript文件以格式化它们的时间应该不会超过10分钟。 If you do that, I suggest that you should send a PR for robinst ;). 如果这样做,建议您发送robinst;)的PR。

UPDATE: It can already, thanks to Robin 更新:感谢罗宾,它已经可以了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM