Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [pde-dev] Problem exporting a package

Hi Brian,

Thanks for your response. I have finally solved it by creating a linked folder to the output class folder of the project to reference and by exporting that dependency in the last tab of the project build path configuration.

Here is the original thread where I posted the solution, maybe it's useful to someone.
http://www.eclipsezone.com/eclipse/forums/t100440.html

Best regards,
Fernando

On 8/24/07, Brian Bauman <baumanbr@xxxxxxxxxx> wrote:

Hi Fernando,

This is a problem many people run into with PDE when they first start using it.

Each PDE project represents an OSGi Bundle.  Each PDE project has a MANIFEST.MF file which specifies information about the bundle and its contents.  Unfortunately, since a basic java project is not an OSGi bundle, the runtime will not be able to load/find classes from the java project or its source folder.

So now, how do we resolve this.  You have two options.

1. Convert your NORMAL project to a PDE project.  This will make the NORMAL project represent an OSGi bundle.  Then you can add the Export-Package statement to the NORMAL project's MANIFEST.MF.  

If you do this, you also need to update your dependency.  Since the runtime deals only with bundles, it is not aware of a project's build path.  Therefore, if you add projects/libraries to a PDE project's build path that the OSGi runtime is not aware of, it won't find the classes.  To fix this, open the MANIFEST.MF of the NORMAL project.  Look for the Bundle-SymbolicName header, it should specify an id.  Then, open OSGIPROJ's MANIFEST.MF file with the Plug-in Manifest Editor.  Flip to the Dependencies tab.  Then in the Required Plug-ins section, click the Add... button.  Then select the id specified in the NORMAL project's Manifest.MF.

The result is two bundles.  This allows the runtime to find classes in each project. Then you placed a dependency from the OSGIPROJ to the NORMAL project so OSGIPROJ can load/reference classes from NORMAL.

2. Move the source from the NORMAL project into the OSGIPROJ.  This should satisfy the Manifest Builder.  The simple way to do this is to copy/move the packages from the NORMAL project into the existing source folder of OSGIPROJ.  If you have conflicting packages, you will need to do something a little more advanced.  If this is the case, go ahead and reply to this post and I can give you more details.  

This will result in one bundle that has the classes of both the NORMAL and OSGIPROJ.  

Good luck!

Brian Bauman
    IBM Software Group - Austin, TX
    Eclipse Committer
    baumanbr@xxxxxxxxxx
    (512) 838 -2938 (T/L 678-2938)



"Fernando Gonzalez" <fergonco@xxxxxxxxx>
Sent by: pde-dev-bounces@xxxxxxxxxxx

08/24/2007 06:46 AM

Please respond to
"Eclipse PDE general developers list." <pde-dev@xxxxxxxxxxx>

To
pde-dev@xxxxxxxxxxx
cc

Subject
[pde-dev] Problem exporting a package







Hello,

I'm trying to reference a normal Java project called "NORMAL" from a
OSGi plugin project called "OSGIPROJ" in eclipse.

In OSGIPROJ I can configure the classpath to reference the NORMAL
project so I can use every class in that project without any problem.

The problem happens when I try to export a package contained in the
NORMAL project with a Export-Package header in the manifest file of
the OSGIPROJ project.

The manifest builder complains saying: Package 'org.normal' does not
exist in this plug-in. I can export any package of any jar dependency
without any problem but I can't with a referenced project.

Does anyone knows how to link a OSGi project with normal java project
and be able to export some package from the normal project?

Best regards,
Fernando

P.S.:

So far, I have tried to have in the Bundle-ClassPath of the manifest
file the following:

1) Add a external dependency to the output directory of the NORMAL project
Bundle-ClassPath: .,
external:/path/to/normal/project/bin,
morejars.jar,
...

2) Create a link in the OSGIPROJ project to the output directory of
NORMAL and add the linked folder in the manifest
Bundle-ClassPath: .,
linked/bin,
morejars.jar,
...

But without success, the manifest builder goes on complaining...
_______________________________________________
pde-dev mailing list
pde-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/pde-dev


_______________________________________________
pde-dev mailing list
pde-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/pde-dev



Back to the top