Summary: | Problems including external Jars in PDE project. | ||
---|---|---|---|
Product: | [Eclipse Project] Platform | Reporter: | Adam Terrenzio <adam.terrenzio> |
Component: | Resources | Assignee: | DJ Houghton <dj.houghton> |
Status: | RESOLVED DUPLICATE | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | rodrigo |
Version: | 2.0 | ||
Target Milestone: | 2.0 F3 | ||
Hardware: | PC | ||
OS: | Windows 2000 | ||
Whiteboard: |
Description
Adam Terrenzio
2002-06-05 10:28:27 EDT
Adam, your comments about adding external JARs references could be reviewed after 2.0. In order to solve your problem you cannot depend on external JARs. All plug- ins have to be self-contained or depend on other plug-ins. You can provide the external JARs in a plug-in library (like the way we provide Xerces in the org.apache.xerces and JUnit in the org.junit plugin). Doing so, your plugin can require the plug-in library and the JARs will be available for it. The Team API is built to interact with outside repository providers and their installed clients as an integration with a minimal level of effort on the workbench side. The entire purpose of it is to access outside code so that the developer does not have to leave the workbench interface to reap the benefits of source code control. Thank you for your comments - I have searched help and not found any crisp documentation on how to set up a 'plug-in library' that contains the jar. Could you be more specific with instructions on how to set this up and make sure the export works appropriately so that my JAR is bundled with the plug-in? Thanks, Adam. Basically you will have to create a plugin that contains all JARs you need and declare these JARs as plug-in libraries. Here is the plugin.xml for xerces as an example: <?xml version="1.0" encoding="UTF-8"?> <plugin name="%pluginName" id="org.apache.xerces" version="4.0.3" provider-name="%providerName"> <!-- This is an IBM maintenance branch of xerces 2.0.0 --> <runtime> <library name="xmlParserAPIs.jar"> <export name="*"/> </library> <library name="xercesImpl.jar"> <export name="*"/> </library> </runtime> </plugin> If you do not or cannot have a plug-in with these JARs, another alternative would be to build a ClassLoader that knows how to find the JARs in order to load the necessary classes but this solution can be very tricky to get done right. I recomend the plug-in library approach. Thanks for all of your help Rodrigo. Do I have to copy my JAR into my local plugin file structure for this to work? But then just out of curiosity - what is the "Add External JARs" button on the Project Properties -> Java Build Path -> Libraries page used for if it doesn't work as expected? It would seem to me that this is exactly what that button should do. Thanks again, Adam. Yes, you do have to copy all the JARs to the plugin folder. The Add External JARs option may not be useful if you are a plug-in developer - and you can get confused like happened to you - but if your Java project is not a plug-in, that's exactly what you want. Thanks again for all of your input. I guess you can close this issue or whatever you have to do with it. Adam. *** This bug has been marked as a duplicate of 3074 *** Copying external jar-files is not acceptable for us. - We do version libraries only once - Libraries are on a central server and only referenced by projects - Not every project creates a jar file, but should be possible to get referenced in a plugin as project I see no reason why defining dependencies in Properties->Build-Path->Libraries and mark as export should not also work in PDE. A solution for this problem is as follows: At Build-Time the referenced projects should be compiled and internally added as a jar. External jars should be included at build-time. e.g.: Plugin-project MY_PLUGIN - contains no jar files and only its own source-files - references project (not a plugin) MY_PROJECT - references jar-file \\central-server\jars\xy.jar when building the jars and externalk sources are included in the deployment (but not the source!): MY_PLUGIN-deployment: - contains plugin.jar - contains myProject.jar - contains xy.jar |