私は osgi と bndtools にはかなり慣れていませんが、ここ数日で、bnd ant タスクを使用して jar->bundle の作成が機能し、さらにサードパーティの jar をバンドルとしてラップすることができました (「Export- Package」をマニフェスト ファイルに含めます)。エクスポートとインポートに関しては、bndtools がすべての面倒な作業を行うのに驚くべきことだとコメントしなければなりません。このプロジェクトでの努力に感謝します!
私はおそらくあなたがいくつかの光を当てることができる2つの問題を抱えています:
1
バンドルをフェリックスにロードしようとしていますが、すぐに解決エラーが発生します。この基本的なシナリオでは、omniquery_common と呼ばれる社内バンドルがあり、gson を含むいくつかのサードパーティの jar を使用します。私が解決すると、これが得られます:
Unable to resolve <<INITIAL>> version=null:
missing requirement Require[osgi.identity]{}{filter=(osgi.identity=omniquery_common)} [caused by:
Unable to resolve omniquery_common version=1.0.0.0:
missing requirement Require[osgi.wiring.package]{}{filter=(&(osgi.wiring.package=com.google.gson)(version>=2.2.0)(!(version>=3.0.0)))}]
私には、これは omniquery_common が com.google.gson (少なくとも 2.2 で 3.0 未満のバージョン) をインポートしていることを示しています。gson バンドルはバージョン 2.2.4 をエクスポートしているため、これはその依存関係を満たす必要がありますが、そうではありません。
これをどのように間違って配線しているかを理解するのを手伝ってもらえますか?
omniquery_common のマニフェスト:
Manifest-Version: 1.0
Bnd-LastModified: 1442336803995
Bundle-ManifestVersion: 2
Bundle-Name: omniquery_common
Bundle-SymbolicName: omniquery_common
Bundle-Version: 1.0.0.0
Created-By: 1.8.0_40 (Oracle Corporation)
Export-Package: com.radian6.omni.common.osgi;version="1.0.0"
Import-Package: com.google.gson;version="[2.2,3)",com.radian6.omni.commo
n.util,org.apache.commons.io;version="[1.4,2)",org.apache.commons.lang;
version="[2.6,3)",org.junit
Private-Package: com.radian6.omni.common.core
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.7))"
Tool: Bnd-2.4.1.201501161923
gson のマニフェスト:
Manifest-Version: 1.0
Export-Package: com.google.gson;version=2.2.4, com.google.gson.annotat
ions;version=2.2.4, com.google.gson.reflect;version=2.2.4, com.google
.gson.stream;version=2.2.4, com.google.gson.internal;version=2.2.4, c
om.google.gson.internal.bind;version=2.2.4
Bundle-ClassPath: .
Built-By: inder
Bundle-Name: Gson
Created-By: Apache Maven 3.0.4
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: Google Gson Project
Bundle-ContactAddress: http://code.google.com/p/google-gson/
Bundle-Version: 2.2.4
Build-Jdk: 1.7.0_21
Bundle-ManifestVersion: 2
Bundle-Description: Google Gson library
Bundle-SymbolicName: com.google.gson
Archiver-Version: Plexus Archiver
2
「実行要件」リストのバンドルの順序を変更し、gson バンドルを omniquery_common の前に配置すると、
Unable to resolve <<INITIAL>> version=null:
missing requirement Require[osgi.identity]{}{filter=(osgi.identity=com.google.gson)}
私は直感的ではないと思います-そのリストのバンドルの順序は問題ではないと思っていたでしょう...?