Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » How to resolve dependencies against fragments in a target platform?
How to resolve dependencies against fragments in a target platform? [message #695292] Mon, 11 July 2011 08:52 Go to next message
Paul
Messages: 2
Registered: July 2011
Junior Member
Hello all,

I was hoping someone could help with an issue I have been having with resolving dependencies against fragments in a target platform.

I'm working on a project using Equinox. We are developing a framework application that supports multiple teams, each writing their own components (plugins).

I would like to supply them with a target platform (our framework) which they can point to within Eclipse, allowing them to develop their plugins against it. This all works fine, apart from one major drawback... none of the packages exported by fragments contained in the target platform are resolved by the workspace (the target plugins are resolved without problem). This leads to a raft of "cannot be resolved to a type" errors, even though when you actually launch, everything resolves fine at runtime.

For information, one fragment contains a lib directory containing 3rd party jars that some teams use. The relevant packages supplied by these jars are exported by the fragment. If a plugin needs any of these packages, it lists them as an imported dependency.

This problem does not occur when you have the offending fragments actually checked out as projects within your workspace, but this is a rather ugly implementation to have to give the component teams.

On a similar note (probably due to the same mechanism), I have had an issue when trying to run a headless build of a plugin I have developed. It cannot build the plugin as it fails to resolve the classes contained in the fragments within the target platform, even though it is pointing right at them! Again, I can build it from the workspace when I have the target platfrom checked out too.

Is this really the case, or is there hope?! How can I get Eclipse to "see" the packages I need?! How can I make my headless build resolve its dependencies?!

Any help is greatly appreciated.

Kind Regards

Paul

[Updated on: Mon, 11 July 2011 08:53]

Report message to a moderator

Re: How to resolve dependencies against fragments in a target platform? [message #695317 is a reply to message #695292] Mon, 11 July 2011 09:39 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas Watson
Messages: 427
Registered: July 2009
Senior Member
What version of Eclipse are you using. This could be bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=157375 which is fixed in 3.7 (Indigo). It could also be because you are providing API from fragments. PDE does not support this by default. You must put the header Eclipse-ExtensibleAPI: true in the manifest of your host bundle. See http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fbundle_manifest.html and search for the header Eclipse-ExtensibleAPI.

HTH

Tom.
Re: How to resolve dependencies against fragments in a target platform? [message #695706 is a reply to message #695317] Tue, 12 July 2011 07:32 Go to previous messageGo to next message
Paul
Messages: 2
Registered: July 2011
Junior Member
Thanks for the reply Thomas, I've had a good look at the links you provided Smile

I'm downloading Indigo as I speak, so I'll try that out soon!

We are trying to provide API from the fragment. Basically we are using JIDE, and have several JIDE jars in the lib folder of the fragment. Actually the fragments only purpose is to supply these jars! The fragment's host is the system.bundle referenced in the framework target platform. The reasons for this choice are not know, as this was all setup by a previous team member. I'm guessing it's for the framework developers, so the plugins that makes up the framework are able to build against it in the workspace.

What I'd like to do is create a target platform for our plugin developers (After the framework is built, I took all the jar files that make it up, and put them with the framework target platform). I was hoping they could just use this as their target platform to develop the plugins against. This works fine apart from resolving the JIDE dependencies. I'm not sure if it's due to it being a fragment, or due to the nested jars?

Eclipse-ExtensibleAPI is set to true in the system.bundle. It seems to me it's all down to the nesting. I may try and split the jars into seperate fragments and see if this works, but my team don't like this, and this doesn't sound like a great solution (we are lucky we don't have alot of jars, but if you did, it would be pretty ridiculous).

I tried setting the fragment unpack=true, which semi-worked... now the manifest of the plugin I developed no longer shows errors on the JIDE import packages, however, the packages still cannot be resolved in my code, even though the manifest seems to have been satisfied :/

Any further help/suggestions on a better way of doing this are appreciated as always.

Cheers
Paul
(no subject) [message #696406 is a reply to message #695706] Wed, 13 July 2011 17:43 Go to previous messageGo to next message
Bruce Kelly is currently offline Bruce Kelly
Messages: 63
Registered: July 2009
Member
I'm not sure if it is relevant but we had an issue with fragments
exporting API which seems to be due to a limitation in PDE.

The situation is that fragement A on a host bundle exports packages that
are imported by fragment B on the same host bundle.

Using the masifest editor, PDE allowed fragment B to import the packages
from fragment A but the corresponding jar file wasn't added to the JDT
classpath for fragment B, so JDT reported errors. The manifest for the
host bundle included the Eclipse-ExtensibleAPI header.

We worked around the problem by creating a custom classpath container
that is added to the classpath of the project for fragment B. The custom
container then adds the missing jar files so JDT can find the packages
exported by fragment A.

Namaste, Bruce
Re: How to resolve dependencies against fragments in a target platform? [message #698868 is a reply to message #695706] Wed, 20 July 2011 08:03 Go to previous message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Why not simply create a plugin, instead of a fragment? In Eclipse we turn each 3rd party library into its own plugin (see http://www.eclipse.org/orbit ). In most cases that simply means its exactly the same jar as before, but its MANIFEST.MF is update to have the Bundle-* headers and Export-Packages. As a fully participating bundle it can be versioned, it can be replaced independently (often a requirement of 3rd party library licenses), etc.


JIDE doesn't sound like it's part of the system.bundle, maybe it was done that way as a cheap trick to not have to import any packages or require a bundle in the MANIFEST.MF?

Later,
PW


Previous Topic:How to install Equinox
Next Topic:p2 director problems without running the target application
Goto Forum:
  


Current Time: Tue Sep 02 12:47:46 EDT 2014

Powered by FUDForum. Page generated in 0.02872 seconds