[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [equinox-dev] How can I embed a JAR in a plugin?
- From: "Stuart McCulloch" <stuart.mcculloch@xxxxxxxxxx>
- Date: Wed, 9 May 2007 10:53:04 +0200
- Delivered-to: firstname.lastname@example.org
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=mmmXOsAYgSOuWlcS+y+uOLCtgAFZtLYcAcTcSiKnX8TmPemlf0t4z61HMCTPzZpZxvm7ex8/pITFX5WGXLngbC2vvvwWzEKYiVxqN8MdkYz6Dh8n+BHuHxkkut/hVUsafgiODJNru8lDu0vpoSnCTF5Mspo41GGMYvZnnk16oiQ=
There's an example of using bnd + maven to embed jars over at OPS4J:
just unpack and run 'mvn clean install' and you can import it into Eclipse.
At the moment you have to do an extra step to link the 'target/lib' folder
to 'lib' in the Eclipse project, but once you do that everything looks ok.
Eclipse seems to like to find embedded jars at the same position relative
to the project root as specified in the Bundle-ClassPath - for example if
you have Bundle-ClassPath: .,lib/foo.jar then you should have lib/foo.jar
in your project folder. (there may be a better way to alias the lib folder
than using an Eclipse link - perhaps a build.properties setting?)
I'm going to provide a single Pax Construct command to automate this,
hopefully next week (in Sweden at the moment running an OSGi tutorial).
On 09/05/07, David Leangen <osgi@xxxxxxxxxxx> wrote:
I've been meaning to try out bnd for a while now... I didn't realise
that it could so easily turn an existing jar into a bundle. Sounds very
useful! I'll give that a try and compare results.
In any case, regarding what I did manually, I forgot to mention that I
did of course export each of the packages. Here's the manifest I used:
On Wed, 2007-05-09 at 09:12 +0100, Alex Blewitt wrote:
> The Bundle-ClassPath gives the bundle visibility, but doesn't export
> any of the contents. So doing:
> Bundle-ClassPath: .,thirdparty.jar
> means that classes inside the bundle will be able to see code in
> thirdparty.jar, but that doesn't imply any other people who depend on
> it will see them. You'll need to add
> Export-Package: com.example.thirdparty,com.example.thirdparty.other
> for each package that you want to expose.
> You might find that the 'bnd' tool (http://www.aqute.biz/Code/Bnd),
> which can automatically convert an existing Jar into an OSGi bundle,
> might be better suited to your needs.
> On 09/05/07, David Leangen <osgi@xxxxxxxxxxx> wrote:
> > Since many OSS projects do not package their code as osgi bundles, I've
> > had to create my own bundles from time to time.
> > This time, I thought that rather than including it as a project in my
> > Eclipse environment, I'll put the bundle in my plugins directory.
> > However, I have not yet been able to figure out how to expose the
> > classpath of the embedded jar file to my projects in the workspace.
> > If I directly compile the code (thus all the class files are in "." in
> > the bundle rather than in a jar in the bundle), I can include the bundle
> > this way without any problems.
> > I thought that I only needed to include the jar in the Bundle-ClassPath
> > entry in the manifest, but Equinox does not recognize this.
> > What does Equinox require that I do to expose this embedded jar to my
> > projects in Eclipse via my plugin bundle?
> > Thank you!
> > David
> > _______________________________________________
> > equinox-dev mailing list
> > equinox-dev@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/equinox-dev
equinox-dev mailing list