[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] How can I embed a JAR in a plugin?


We usually do #2. I feel that using embedded jars keeps the bundles
cleaner, and updating the jars is a bit easier. As Tom pointed out,
though, there are reason to go with #1, one being that you can use the
jar with PDE without exploding it. It's really a matter of team

We have tooling that populates the PDE target platform with bundle
dependencies from our
internal repository.  When doing so, it automatically determines
whether or not the bundle needs to be exploded in the target platform.

- Jeremy

On 5/9/07, David Leangen <osgi@xxxxxxxxxxx> wrote:


Thank you! That completely answers my question.

You mentioned two ways to do this:

 - extract the contents (i.e. class files) of thirdparty.jar into a
    folder in the bundle's ".", or

 - keep the jar intact, but use a directory structure instead of
   a jar file (which contains thirdparty.jar)

What is the "usual" or "best" practice?

Cheers, David

> -----Original Message-----
> From: Jeremy Volkman [mailto:jvolkman@xxxxxxxxx]
> Sent: 9 May 2007 19:35
> To: osgi@xxxxxxxxxxx; Equinox development mailing list
> Subject: Re: [equinox-dev] How can I embed a JAR in a plugin?
> David,
> If I understand your problem correctly, you're trying to include this
> third party jar in your Eclipse target platform so that it can be used
> by plugin projects in your workspace. If this is the case, you're
> running into the fact that Eclipse PDE doesn't support developing
> against bundles with embedded jars.  This is not Equinox's problem,
> but rather a side effect of PDE being dependent upon the JDT, and
> JDT's inability to find a class that's within an embedded jar.
> To put a bundle with an embedded jar in your target platform, simply
> extract it.  E.g., if your bundle was "com.somecompany.mybundle.jar",
> you'd extract it to a directory called "com.somecompany.mybundle"
> inside your plugins directory.  You can see that many of the Eclipse
> plugins are distributed like this.
> Another thing to note is that you can change the PDE target platform
> directory to something other than the Eclipse plugins directory.  This
> allows you full control over which bundles are available to your
> workspace bundles and removes all the distributed Eclipse bundle
> exports. The option is under Preferences -> Plug-in Development ->
> Target Platform. This of course is not what you want if you're
> developing an Eclipse plugin. :)
> Hope that helps,
> Jeremy
> On 5/9/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