Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 133948 - Product export wizard fails with plug-ins created from existing JAR archives
Summary: Product export wizard fails with plug-ins created from existing JAR archives
Status: RESOLVED DUPLICATE of bug 146042
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: PDE-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-29 18:34 EST by Alan Green CLA
Modified: 2006-06-08 19:55 EDT (History)
3 users (show)

See Also:


Attachments
logs.zip file containing unexpected error messages (560 bytes, application/octet-stream)
2006-03-29 18:35 EST, Alan Green CLA
no flags Details
ReferToMe.java - Single source file compiled into simple.jar (101 bytes, text/plain)
2006-03-29 18:36 EST, Alan Green CLA
no flags Details
simple.jar - JAR file used to make new "Plug-in from existing JAR archive" (583 bytes, application/octet-stream)
2006-03-29 18:38 EST, Alan Green CLA
no flags Details
RcpExample MANIFEST.MF (317 bytes, text/plain)
2006-03-30 17:17 EST, Alan Green CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Green CLA 2006-03-29 18:34:26 EST
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.
Comment 1 Alan Green CLA 2006-03-29 18:35:49 EST
Created attachment 37255 [details]
logs.zip file containing unexpected error messages
Comment 2 Alan Green CLA 2006-03-29 18:36:59 EST
Created attachment 37256 [details]
ReferToMe.java - Single source file compiled into simple.jar
Comment 3 Alan Green CLA 2006-03-29 18:38:49 EST
Created attachment 37257 [details]
simple.jar - JAR file used to make new "Plug-in from existing JAR archive"
Comment 4 Alan Green CLA 2006-03-29 18:53:59 EST
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.
Comment 5 Alan Green CLA 2006-03-29 20:06:02 EST
Just checked, and this works on 3.1.1.
Comment 6 Alex Blewitt CLA 2006-03-30 04:50:14 EST
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.
Comment 7 Paul Webster CLA 2006-03-30 07:42:28 EST
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
Comment 8 Alan Green CLA 2006-03-30 17:17:20 EST
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.
Comment 9 Alan Green CLA 2006-03-30 17:38:13 EST
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 >>

Comment 10 Reinier Zwitserloot CLA 2006-05-15 21:50:05 EDT
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).
Comment 11 Alex Blewitt CLA 2006-05-16 03:51:26 EDT
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.
Comment 12 Reinier Zwitserloot CLA 2006-05-16 09:14:46 EDT
(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!
Comment 13 Alan Green CLA 2006-05-16 23:34:00 EDT
(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.
> 
Comment 14 Alan Green CLA 2006-05-16 23:39:12 EDT
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.
Comment 15 Alan Green CLA 2006-05-16 23:51:45 EDT
Tested with Eclipse 3.2RC4, and it still not working.
Comment 16 Wassim Melhem CLA 2006-06-08 19:55:03 EDT
see bug 146042 comment 1 for workaround.

*** This bug has been marked as a duplicate of 146042 ***