Adding a package from another project to plug-in build path
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Mark_Johnson
Posted On:   Saturday, November 4, 2006 09:26 AM

I'm going nuts trying to get a plug-in to run. My plugin ("ModulePlugin") uses code in a package that exists in another Java project ("ModuleCore") that is not itself a plugin. My plugin code has an import that looks something like: import com.foo.modulecore.FileReader; Eclipse marks that import as an error because "com.foo.modulecore is not visible". The QuickFix is to add ModuleCore (the project) to the plugin's build path. I select that fix and the problem disappears. But when I run the plugin, the plugin code that uses FileReader can't find it. I can only see the ClassNotFoundException if I run the platform in debug mode; otherw   More>>

I'm going nuts trying to get a plug-in to run.


My plugin ("ModulePlugin") uses code in a package that exists in another Java project ("ModuleCore") that is not itself a plugin.


My plugin code has an import that looks something like:


import com.foo.modulecore.FileReader;


Eclipse marks that import as an error because "com.foo.modulecore is not visible". The QuickFix is to add ModuleCore (the project) to the plugin's build path. I select that fix and the problem disappears.


But when I run the plugin, the plugin code that uses FileReader can't find it. I can only see the ClassNotFoundException if I run the platform in debug mode; otherwise, I just get a console message:

			
Unhandled event loop exception
Reason:
com/foo/modulecore/FileReader


So supposedly, the quick fix fixes the build path, but when I run it, the plugin can't find the code.


Also, if I use PDE Tools->Build classpath... before trying to run the platform, the original error ("com.foo.modulecore is not visible") reappears.


What am I missing here?


Thanks a lot to anyone who can help me with this. I'm new at developing plugins, and it's a bit overwhelming.

   <<Less

Re: Adding a package from another project to plug-in build path

Posted By:   Anonymous  
Posted On:   Wednesday, November 8, 2006 10:13 PM

Mark:
I saw your post on IRC.

Your external jar must be either in a plugin or a plugin itself.

The java classpath and plugin classpath are two different albeit related things.

IN PDE, the java classpath should be only a result of the plugin classpath.

When you add a project to you java classpath, pde does not know about it. And when you update the PDE classpath, it loose you settings.

So the solution is to make theis other java project a plugin project.

And adjust:

- the build.properties ,

- export your packages in the manifest of that plugin

- require that plugin or import the packages in the manifest of the plugin that consumes it.

ping me on irc if you need more help.
/HTH



--

Cheers

Philippe


philippe ombredanne | 1 650 799 0949 | pombredanne at nexb.com

nexB - Open by Design (tm) - http://www.nexb.com

http://easyeclipse.org - irc://irc.freenode.net/easyeclipse nick pombreda
About | Sitemap | Contact