Eclipse PDE: Package does not exist in this plug-in
We are developing an Eclipse plugin that is split into several Eclipse Projects. We want to export some of the classes that are defined in these external projects (via Export-Package in MANIFEST.MF). The problem is that Eclipse gives an error "Package xxx does not exist in this plug-in".
To give an example, let's assume that the plug-in is project P1 and this one uses some classes defined i开发者_开发技巧n a separate Eclipse project P2. We want to bundle P2 together with P1 and export some of the classes of P2 via the MANIFEST.MF of P1.
This works if I generate a jar file (P2.jar) and add this in the build path of P1, however it does not work if I simply add P2 as a dependency of P1.
Any suggestions what is the reason of the "Package xxx does not exist in this plug-in"?
Any suggestions how to get rid of it?
Adding the project P2 as dependency of P2 simply add the build classes of P2 (assuming P2 is a Java project) to the classpath of P1. This will allow P1 to compile but will result in wrong behavior at run-time.
Because your project P1 is a plugin project all its dependencies must be added ever through the dependencies tab of the manifest editor or through a jar file included as you mentioned.
So the only solution is to transform P2 project into plugin project and then let your P1 plugin depends on it. This kind of plugin only exporting code but not contributing anything to the ide are often referenced as library plugins. More and more java libraries are now delivered also in this way to let clients use them in Eclipse context (for example log4j).
精彩评论