0

I want to use cglib in an RCP client. The RCP client is build using maven and the tycho plugin. We are useing a manifest first strategy.

This is my 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",
 ...

To add cglib I changed the Import-Package section to:

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

Now Eclipse complains with:

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

Ayn ideas how to include cglib with this environment?

BetaRide
  • 16,207
  • 29
  • 99
  • 177
  • 1
    Well you need a cglib Bundle that provides this package in your environment. In Eclipse you usually do that with a custom target platform ( .target file, see for instance this [Tutorial](http://www.vogella.com/tutorials/EclipseTargetPlatform/article.html) ) that you can also reference in your Tycho build. – stempler Nov 01 '16 at 08:41

2 Answers2

1

You will need to add the cglib bundle to your target platform, i.e., the set of all bundles Tycho will consider when resolving dependencies. You have three options to do so (taken from the Tycho wiki page on this topic):

  1. You can simply add an entire p2 repository to your target platform.
  2. You can use a .target file and reference the cglib bundle therein (as already suggested by stempler).
  3. You can declare a Maven <dependency> on cglib and make Tycho “consider” it.

As you already have a working Tycho build, I suggest you use whatever option you or your colleagues have used in the build before.

One more note: Options 1 and 2 require that the cglib bundle is available in a p2 repository, whereas option 3 works even if the bundle comes from a “normal” Maven repository like the Central Repository. But in all three cases the cglib JAR must be a valid OSGi bundle, i.e., include an OSGi MANIFEST.MF with Bundle-SymbolicName etc.

Community
  • 1
  • 1
Andreas Sewe
  • 1,558
  • 9
  • 18
0

You should build the cglib jar file to a plugin and install it in Eclipse before you can use it. You can refer to this link: How can I add the external jar to the eclipse rcp application?

Community
  • 1
  • 1
Dave Pateral
  • 1,415
  • 1
  • 14
  • 21