我想构建 osgi 组件,我被告知要使用maven-bundle-plugin
. 我首先将它添加到我的pom.xml
:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.0.0</version>
<extensions>true</extensions>
<configuration>
<obrRepository>NONE</obrRepository>
<instructions>
<_include>-bnd.bnd</_include>
</instructions>
</configuration>
</plugin>
注意.bnd
传递给<_include>
标签的文件。我听说有人说这些文件应该保持在最低限度,甚至是空的,然后应该观察需要哪些导入/导出等。这就是我感到困惑的地方。我有我的MANIFEST.MF
文件,我知道要在其中导入和导出什么。但是,我需要一些帮助才能使我的.bnd
文件正常工作。现在我正在尝试使用空.bnd
文件,但我不确定它是否正常工作。
有没有人对这个插件有任何经验以及我想让它工作的方式?
例如,这是一个示例.bnd
文件。但是我不知道他是如何决定这些应该存在进口/出口的。
截至目前,当我尝试测试.jar
我得到
no main manifest attribute, in bundle-1.0.0.jar
尽管. MANIFEST.MF
_.jar
更新:我想我可以分享MANIFEST.MF
我以前拥有的,我现在想通过这个插件生成的。
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Just a Name
Bundle-SymbolicName: just.a.name.broker;singleton:=true
Bundle-Version: 1.0.0
Require-Bundle: org.apache.activemq,
just.msg
Bundle-Activator: just.a.broker.Activator
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: javax.naming,
javax.xml,
javax.xml.parsers,
org.apache.log4j.xml,
org.osgi.framework
Bundle-ClassPath: .
Export-Package: just.a.broker
所以为了有这样的清单,我的.bnd
文件应该是什么样子?还是在插件中包含属性而不是传递.bnd
文件更好?