Community
Participate
Working Groups
I am using Eclipse 3.2M5a and attempting to build a product. I can build the Hello RCP example, but when I modify the project to reference a plugin project that was created with "File > New > Project ... Plug-in from existing JAR archives", the build fails. Steps to reproduce: 1. Start with fresh 3.2M5A install from eclipse-SDK-3.2M5a-win32.zip, and a new workspace 2. File>New>Project...>Plug-in Project * Name: RcpExample, * Click Next. * Would you like to create a rich client application?: Yes * Click Next. * Select "Hello RCP" * Click Finish 3. RcpExample Configuration editor now open * From overview page * Under "Testing", select "Launch an Eclipse application" <<Hello RCP application launches, as expected>> * Close launched app 4. From package explorer, select the RcpExample application 5. File > New > Product Configuration * File name: RcpExample.product, Finish 6. In Product configuration editor * On Overview page * Product Name: RcpExample * Product ID: New... <<Dialog appears>> Click Finish * On Configuration page * Click Add... Choose RcpExample * Click Add Required Plugins * Back On Overview page * Under Testing: Click "Synchronize", * Under Testing: Click "Launch the product" <<Application launches, as expected>> * Close launched app * Back On Overview page * Under Exporting: Click "Eclipse Product export wizard" * <<Dialog appears>> * Root directory: rcpexample * Set Destination directory to something appropriate * Click Finish * Find newly created app directory in Windows Explorer and double-click eclipse.exe. <<Application launches fine.>> *** We have built Hello RCP and it is all good so far *** *** Now to add an imported JAR file. *** 7. File > New > Project... > Plug-in from existing JAR archives * Click Next * Click "Add External" and select simple.jar (attached) from file system * Click Next * Project name: ImportedSimple * Click Finish 8. Open Manifest editor for RcpExample plug-in * On Dependencies page, add "ImportedSimple" 9. Open Activator.jar * Add a static initializer: static { System.out.println(ReferToMe.FRED); } * Organize Imports, and Save. 10. Open product configuration editor * On Configuration page, add "ImportedSimple". * Save Configuration * On Overview page * Under Testing: Click "Synchronize", * Under Testing: Click "Launch the product" <<Application launches, as expected>> <<See "yyyy" in console view>> 11. Still in product configuration editor * On Overview page * Under Exporting: Click "Eclipse Product export wizard" * <<Dialog appears>> * Click Finish <<Error dialog appears with message:>> "Errors occured during the operation. A zip file containing the build logs has been generated and placed at ..." Contents of logs.zip is one file named "@dot.bin.log", with the following messages: # 30/03/06 9:33:14 # Eclipse Java Compiler 0.642, 3.2.0 milestone-5, Copyright IBM Corp 2000, 2006. All rights reserved. ---------- 1. ERROR in C:\work\eclipse3.2M5a\workspace-a\RcpExample\src\rcpexample\Activator.java (at line 7) import a.pkg.name.ReferToMe; ^ The import a cannot be resolved ---------- 2. ERROR in C:\work\eclipse3.2M5a\workspace-a\RcpExample\src\rcpexample\Activator.java (at line 18) System.out.println(ReferToMe.FRED); ^^^^^^^^^ ReferToMe cannot be resolved ---------- 2 problems (2 errors) Will attach Simple.jar and logs.zip.
Created attachment 37255 [details] logs.zip file containing unexpected error messages
Created attachment 37256 [details] ReferToMe.java - Single source file compiled into simple.jar
Created attachment 37257 [details] simple.jar - JAR file used to make new "Plug-in from existing JAR archive"
And I should add, that I was able to successfully build the application if, instead of importing simple.jar, I made a separate plug-in project containing ReferToMe.java as a source file.
Just checked, and this works on 3.1.1.
This is a classic example of putting the Jar in the .classpath instead of the Manifest.MF's Bundle-Classpath entry. If you can post your MAnifest.MF of the containing plugin, we should be able to determine whether that was the cause or not.
I just checked in I20060330-0010 and the problem still exists. This is the manifest for my test jar converted into a plugin. It looks fine. Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Logging Plug-in Bundle-SymbolicName: z.ex.logging Bundle-Version: 1.0.0 Bundle-ClassPath: . Bundle-Localization: plugin Export-Package: z.ex.logging PW
Created attachment 37363 [details] RcpExample MANIFEST.MF The MANIFEST.MF file from the RcpExample plugin, as requested by Alex. Just to make sure we are on the same page here: this plug-in doesn't contain the JAR file, rather, it refers to the another plugin that was created by importing a JAR file.
Thanks to Alex's suggestion on the rcp newsgroup, I have a workaround. It appears that a custom build with an unmodified generated Ant script works as expected. 1. In the Package Explorer * Right click plugin.xml and select PDE Tools>Generate Ant Build File. 2. Open Manifest editor for RcpExample plug-in * On Build Configuration page, check the "Custom Build" checkbox * Save 3. Open product configuration editor * On Overview page * Under Exporting: Click "Eclipse Product export wizard" * <<Dialog appears>> * Click Finish << No error >> 4. Open command prompt in build directory * Run "eclipse.exe -consoleLog" << Application starts >> << 'yyyy' appears on stdout >>
Confirming the bug - I followed the hyperbola example almost to the letter from the Eclipse Rich Client Platform book by Jeff McAffer and Jean-Michel Lemieux (ISBN 0-321-33461-2). There are two problems - one is the current bug under discussion (The workaround in comment #9 actually works, fortunately, so I can continue), but another is a very weird situation with import recognition: During development, none of the org.jivesoftware.smack.* stuff is 'recognized'. That is - ctrl+shift+T or just ctrl+space on 'Roster' does NOT find org.jivesoftware.smack.Roster. I can however manually type the full import statement (auto-complete here doesn't find anything either). This works and does not cause any exceptions or build problems. However, Roster STILL won't auto-complete. Even stranger: 2 classes (XMPPConnection and XMPPException) from org.jivesoftware.smack -do- autocomplete, and show up in the type overview, etcetera. Going back to the main bug here - it works fine when running the app from inside eclipse, as a product. It's the export wizard that bombs out. Also, it only fails to work for other plugins you're creating - anything inside the target works fine (so all the eclipse RCP stuff works, and an RCP app that consists of just 1 new plugin also works).
I note from the manifest.mf that there's no Bundle-Classpath: . which would seem normal if there were classes in it. I also note that ImportedSimple as a bundle name doesn't have any dots in the name; there are situations where it's important to have a dot-separated name for a bundle and non-dot separated names may make a difference. So com.importedsimple may be treated differently than importedsimple. Re: type auto complete and imports; if the classpath gets out of step then it may be necessary to do one of clean or close/reopen project to get JDT to rebuild the caches of known classes. It may be that the only two that auto-complete are ones that you're already referring to in class code; which is what I'd expect from an Exception class, since it would be part of a method signature. I'm also going to bet that your XMPPConnection is an argument in some method somewhere, but the Roster class isn't. Alex.
(In reply to comment #11) > I note from the manifest.mf that there's no > Bundle-Classpath: . > which would seem normal if there were classes in it. That line is present in the manifest.mf in my case. Does not make a difference. > I also note that ImportedSimple as a bundle name doesn't have any dots in the > name; there are situations where it's important to have a dot-separated name > for a bundle and non-dot separated names may make a difference. So > com.importedsimple may be treated differently than importedsimple. My example uses fully dotted names. Does not appear to make a difference. Would it help if I uploaded it? It's quite a lot of code, but of course I'll try and cut as much out as possible. It's just the standard eclipsercp book code, also available from http://www.eclipsercp.org/book/cd.php > Re: type auto complete and imports; if the classpath gets out of step then it > may be necessary to do one of clean or close/reopen project to get JDT to > rebuild the caches of known classes. It may be that the only two that > auto-complete are ones that you're already referring to in class code; which is > what I'd expect from an Exception class, since it would be part of a method > signature. I'm also going to bet that your XMPPConnection is an argument in > some method somewhere, but the Roster class isn't. > I've done a lot of cleaning but close and reopen does work. Thanks!
(In reply to comment #11) > I note from the manifest.mf that there's no > Bundle-Classpath: . > which would seem normal if there were classes in it. > > I also note that ImportedSimple as a bundle name doesn't have any dots in the > name; there are situations where it's important to have a dot-separated name > for a bundle and non-dot separated names may make a difference. So > com.importedsimple may be treated differently than importedsimple. > > Re: type auto complete and imports; if the classpath gets out of step then it > may be necessary to do one of clean or close/reopen project to get JDT to > rebuild the caches of known classes. It may be that the only two that > auto-complete are ones that you're already referring to in class code; which is > what I'd expect from an Exception class, since it would be part of a method > signature. I'm also going to bet that your XMPPConnection is an argument in > some method somewhere, but the Roster class isn't. > > Alex. >
Oops... for real this time. (In reply to comment #11) > I note from the manifest.mf that there's no > Bundle-Classpath: . > which would seem normal if there were classes in it. Not necessary in this case, as the plug-in is deployed as JAR file. Many of the plug-ins shipped with Eclipse, such as org.eclipse.core.runtime, don't have a Bundle-Classpath in their manifest.mf. > I also note that ImportedSimple as a bundle name doesn't have any dots in the > name; there are situations where it's important to have a dot-separated name > for a bundle and non-dot separated names may make a difference. So > com.importedsimple may be treated differently than importedsimple. This bug also affects projects where both the bundles have dots in their names, but feel free to verify this by following the steps in the description, substituting dotted project names - it takes less than ten minutes.
Tested with Eclipse 3.2RC4, and it still not working.
see bug 146042 comment 1 for workaround. *** This bug has been marked as a duplicate of 146042 ***