【发布时间】:2016-11-09 12:01:56
【问题描述】:
我想构建 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 文件,但我不确定它是否正常工作。
有没有人对这个插件有任何经验以及我想让它工作的方式?
例如,here 是一个示例 .bnd 文件。但是我不知道他是如何决定这些应该导入/导出的。
截至目前,当我尝试测试 .jar 时,我得到了
no main manifest attribute, in bundle-1.0.0.jar
尽管.jar 中确实存在MANIFEST.MF,但仍会出错。
更新:我想我可以分享我之前拥有的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 文件更好?
【问题讨论】:
标签: maven osgi bnd maven-bundle-plugin