簡體   English   中英

(mis)了解osgi bundle的依賴關系

[英](mis)understanding osgi bundle dependencies

我是osgi和bndtools的新手,但是在過去的幾天里,使用bnd ant任務成功地使jar-> bundle創建工作,以及將我們的3rd party jars包裝為捆綁包(對於那些尚未定義“導出-打包”(在清單文件中)。 我必須指出,bndtools在進行進出口方面的所有繁重工作看來都很棒,因此,感謝您在該項目上的辛勤工作!

我有兩個問題,也許您可​​以闡明一下:

1個

我正在嘗試將捆綁軟件加載到felix中,並立即遇到解析錯誤。 在這種基本情況下,我們擁有名為omniquery_common的內部捆綁包,其中使用了多個第3方jar(包括gson)。 當我解決我得到這個:

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,因此這應滿足其依賴性,但事實並非如此。

您能幫助我了解我如何將其接線錯誤嗎?

omn​​iquery_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)}

我覺得這很不直觀-我會認為該列表中的捆綁銷售順序沒有關系...?

-runrequirements列表需求的-runrequirements 確實很重要,因為如果列表的早期出現錯誤,那么我們就不用費勁嘗試解決它下面的所有內容。 也就是說:一旦我們知道解決方案無法成功,我們就退出並打印遇到的第一個錯誤。

復制的第二條錯誤消息(當您首先提出GSON要求時)表明您的存儲庫中根本沒有GSON捆綁包。 或者,它不在解析程序可見的存儲庫中。 過濾器(osgi.identity=com.google.gson)失敗,這意味着不存在標識為com.google.gson資源。

這還將說明您自己的omniquery_common捆綁包中的第一個錯誤消息。 解析器找不到任何導出軟件包com.google.gson捆綁包,如果GSON捆綁包不存在,這將是很有意義的。

因此,請查看您要解決的存儲庫及其索引所包含的內容。 如果GSON確實確實存在,那么我將需要更多信息以找出問題所在。

順便說一句,一旦完成此工作,就不需要在所有inrunrequirements中明確列出-runrequirements 這就是解析器的重點:我們將根據您使用的軟件包查找所有依賴項。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM