2016-10-31 38 views
0

我想在RCP客戶端中使用cglib。 RCP客戶端使用maventycho plugin構建。我們正在使用清單第一策略。如何將cglib添加到RCP客戶端的OSGI清單中?

這是我的MANIFEST.MF:

Manifest-Version: 1.0 
Bundle-ManifestVersion: 2 
Bundle-Name: INFO+ RCP Common UI Plug-in 
Bundle-SymbolicName: a.company.prj.rcp.common.ui 
Bundle-Version: 8.0.14.qualifier 
Bundle-Vendor: Schweizerische Bundesbahnen SBB 
Bundle-RequiredExecutionEnvironment: JavaSE-1.7 
Bundle-Activator: a.company.prj.rcp.common.ui.CommonUIPlugin 
Bundle-ActivationPolicy: lazy 
Export-Package: 
a.company.prj.rcp.common.ui, 
... 
a.company.prj.rcp.common.ui.wizards.page 
Import-Package: 
org.apache.log4j;version="1.2.17" 
Require-Bundle: 
org.eclipse.ui;bundle-version="3.7.0", 
org.eclipse.ui.forms;bundle-version="3.5.101", 
com.ibm.ws.jpa.thinclient;bundle-version="8.0.6", 
... 
a.company.prj.rcp.core;bundle-version="8.0.14", 
... 

要添加CGLIB我改變了進口包裝部分:

Import-Package: 
net.sf.cglib;version="3.2.0", 
org.apache.log4j;version="1.2.17" 

現在Eclipse的抱怨有:

No available bundle exports package 'net.sf.cglib' 

艾因想法如何將cglib包含在這個環境中?

+1

那麼你需要一個在你的環境中提供這個包的cglib Bundle。在Eclipse中,您通常使用自定義目標平臺(.target文件,請參閱本教程](http://www.vogella.com/tutorials/EclipseTargetPlatform/article.html),您也可以在您的第谷建立。 – stempler

回答

1

您需要將cglib包添加到您的目標平臺,即Tycho在解決依賴性時將考慮的所有包的集合。你有三個選擇這樣做(從Tycho wiki page採取這個話題):

  1. 你可以簡單地add an entire p2 repository to your target platform
  2. 您可以use a .target file並參考其中的cglib包(正如stempler已經建議的那樣)。
  3. 你可以declare a Maven <dependency>cglib並使第谷「考慮」它。

由於您已經有Tycho構建工作,所以我建議您在構建之前使用您或您的同事在構建中使用的任何選項。

還有一點需要注意:選項1和選項2要求在p2存儲庫中提供cglib包,而選項3即使來自像「Central Repository」這樣的「正常」Maven存儲庫,也可以工作。但是,在這三種情況下的cglib JAR 必須是一個有效的OSGi包,即包括與Bundle-SymbolicName等一個OSGi MANIFEST.MF

相關問題