|
|
Re: Class cannot be resolved to a type [message #461497 is a reply to message #461380] |
Wed, 10 January 2007 17:46 |
Eclipse User |
|
|
|
Originally posted by: wegener.cboenospam.com
Gavin Bong wrote:
> Context: Eclipse 3.2.1
> In Bundle <b>A</b>, a class <b>Foo</b> extends an interface <b>IFace</b>
exported by bundle <b>B</b>. However, eclipse is complaining within the editor
of <b>Foo</b>, that <i>IFace cannot be resolved to a type</i>.
> Strangely,
> 1) Bundle B explicitly exports <b>IFace</b>.
> <i>IFace.class</i> resides in a jar file called commons.jar
> in the package "commons".
> e.g. a snippet of the MANIFEST.MF for bundle B.
> Bundle-Classpath: .,lib/commons.jar
> Export-Package: commons
> 2) Bundle A explicitly imports the "commons" package.
> e.g. a snippet of the MANIFEST.MF for bundle A.
> Import-Package: commons
> e.g. Snippet of class Foo:
> public class Foo implements IFace
> {
> ...
> }
> If I do a CTRL+Shift+T, the PDE correctly resolves to the IFace.class file
in <i>commons.jar</i>. So it's very strange that eclipse cannot resolve
<b>IFace</b> in the plugin project for Bundle A. I have cleaned the projects,
exited eclipse and restarted and the error is still there. Anybody can point
me in the right direction.
Does bundle A explicitly depend on bundle B. This would be on
Require-Bundle line of bundle A's manifest.
|
|
|
Re: Class cannot be resolved to a type [message #461555 is a reply to message #461384] |
Fri, 12 January 2007 05:05 |
Gavin Bong Messages: 23 Registered: July 2009 |
Junior Member |
|
|
There's a couple of mistakes in my problem description.
1) In my original post, I said that CTRL+Shift+T will resolve to <i>IFace</i>. I'm wrong, it does not. It is not even listed in the list of suggested classes.
In addition to the error <i>IFace cannot be resolved to a type</i>, I am getting <i>Package commons cannot be resolved</i>.
2) Bundle B which exports package <i>commons</i> does not exist as an opened project in the same workspace. In fact, it exists as an exported plugin jar inside my <b>target-platform</b> directory.
So, if the project for Bundle B is opened in the workspace, there are no errors. But when it is closed and I depend solely on the exported jar in the <b>target-platform</b> directory, the error appears.
I did a little experiment. I created a launch configuration:
workspace plugins := bundle A
target plugins := bundle B, osgi-framework
When I run it, it works fine. Everything is resolved!
Perhaps I do not understand the actual utility of the target-platform. The definition from the HELP file:
<i>Target Platform refers to the platform against which you are developing and testing your plug-ins</i>.
I expected that the PDE would read the MANIFEST.MF file from all plugins in the target platform & add IFace to my build path for Bundle A. Obviously it does not. So like you (Alex) said, I will have to add the commons.jar into Bundle A's project build path; which kinda sucks.
@Dave, a Require-Bundle is basically equivalent to multiple Import-Package as this blogpost http://www.osgi.org/blog/2006/04/misconceptions-about-osgi-h eaders.html suggests.
|
|
|
Re: Class cannot be resolved to a type [message #461601 is a reply to message #461555] |
Sat, 13 January 2007 05:27 |
Eclipse User |
|
|
|
Originally posted by: wegener.cboenospam.com
Gavin Bong wrote:
> There's a couple of mistakes in my problem description.
>
> 1) In my original post, I said that CTRL+Shift+T will resolve to <i>IFace</i>. I'm wrong, it does not. It is not even listed in the list of suggested classes.
>
> In addition to the error <i>IFace cannot be resolved to a type</i>, I am getting <i>Package commons cannot be resolved</i>.
>
> 2) Bundle B which exports package <i>commons</i> does not exist as an opened project in the same workspace. In fact, it exists as an exported plugin jar inside my <b>target-platform</b> directory.
>
> So, if the project for Bundle B is opened in the workspace, there are no errors. But when it is closed and I depend solely on the exported jar in the <b>target-platform</b> directory, the error appears.
>
>
> I did a little experiment. I created a launch configuration:
> workspace plugins := bundle A
> target plugins := bundle B, osgi-framework
>
> When I run it, it works fine. Everything is resolved!
>
>
> Perhaps I do not understand the actual utility of the target-platform. The definition from the HELP file:
>
> <i>Target Platform refers to the platform against which you are developing and testing your plug-ins</i>.
>
> I expected that the PDE would read the MANIFEST.MF file from all plugins in the target platform & add IFace to my build path for Bundle A. Obviously it does not. So like you (Alex) said, I will have to add the commons.jar into Bundle A's project build path; which kinda sucks.
>
> @Dave, a Require-Bundle is basically equivalent to multiple Import-Package as this blogpost http://www.osgi.org/blog/2006/04/misconceptions-about-osgi-h eaders.html suggests.
First, make sure that your plugin is checked in the Target Platform
properties. Then, open up the manifest file in the Plugin Manifest
Editor. Go to the Dependencies tab. Scroll down and open the Automated
Management of Dependencies section. Select the appropriate radio button
at the bottom and click the add dependencies text. This should insure
that your dependencies are correct.
Go to the General tab, Click the Update the classpath and the compiler
compliance settings. This should make sure that your build classpath is
up to date.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03862 seconds