0
我試圖創建一個服務,然後把它放到felix OSGi容器中。我試圖用maven-bundle-plugin
來做到這一點。安裝mvn clean install
包後,也target/classes/META-INF/MANIFEST.INF
我得到填補文件,但在jar
清單如下:OSGi清單是空的
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Built-By: szymon.nowak
Created-By: Apache Maven 3.3.9
Build-Jdk: 1.8.0_77`
,這就是它應該是什麼樣子:
Manifest-Version: 1.0
Bnd-LastModified: 1471013023955
Build-Jdk: 1.8.0_77
Built-By: szymon.nowak
Bundle-Activator: com.cognifide.activators.HelloWorldActivator
Bundle-ManifestVersion: 2
Bundle-Name: Hello World Bundle - service
Bundle-SymbolicName: OSGi Hello World Service
Bundle-Vendor: Szymon Nowak
Bundle-Version: 1.0.0.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Export-Package: com.cognifide.service.first;version="1.0.0"
Import-Package: com.cognifide.service.first,org.osgi.framework;version="
[1.5,2)"
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.5))"
Tool: Bnd-3.2.0.201605172007
事實上,菲利克斯註冊該文件,但它們不起作用,因爲它沒有設置導出包或激活器。這就是我在pom中的插件定義:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<instructions>
<Bundle-SymbolicName>OSGi Hello World Service</Bundle-SymbolicName>
<Export-Package>com.cognifide.service.first</Export-Package>
<Bundle-Activator>com.cognifide.activators.HelloWorldActivator</Bundle-Activator>
<Bundle-Name>Hello World Bundle - service</Bundle-Name>
<Bundle-Vendor>Szymon Nowak</Bundle-Vendor>
</instructions>
</configuration>
</plugin>
編輯。
我用mvn clean install
構建我的項目。也許我應該使用該插件的某個階段?
'executions'在'目標/班/ META-INF'產生了良好的'Manifest'。刪除它後,它仍然不會在我的jar文件中創建好'Manifest'。 – nowszy94