Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 354417

Summary: [jar exporter] Intermittent generation of jardesc from jar export
Product: [Eclipse Project] JDT Reporter: Jon Barrilleaux <jonb>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, henrik.teinelund
Version: 3.8Keywords: needinfo
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Jon Barrilleaux CLA 2011-08-10 14:02:25 EDT
Build Identifier:  20110301-1815

Sometimes, more often than not, the jar exporter fails to generate a jardesc (yes, the checkbox is checked).  I have even tried restarting eclipse but when it fails hard, it never generates a jardesc file.

When it does feel like generating a jardesc, it seems rather confused: Changing the jardesc file to some older name, adding stuff to the exported jar from an older jardesc, etc.

Reproducible: Sometimes

Steps to Reproduce:
1.Open the jar export wizard
2.Select bits and pieces of a project (i.e. only the source and some jar files -- not all the .project junk).
3.Specify a jardes file (directly or via browse button -- when it fails it is a hard fail it makes no difference).
4. Push the finish button.  Jar file is generated and sometimes jardesc is not (and, when it fails hard, it never generates a jardesc).
Comment 1 Dani Megert CLA 2011-08-11 02:29:43 EDT
Is there anything in the .log? Without more info we can't do anything.
Comment 2 Jon Barrilleaux CLA 2011-08-11 02:40:47 EDT
(In reply to comment #1)
> Is there anything in the .log? Without more info we can't do anything.

What log?  I'll send it if you tell be where it is. All I know is that the jar file is reliably generated, but the .jardesc file fails to appear more often than not.
Comment 3 Dani Megert CLA 2011-08-11 02:56:46 EDT
(In reply to comment #2)
> (In reply to comment #1)
> > Is there anything in the .log? Without more info we can't do anything.
> 
> What log?  I'll send it if you tell be where it is. All I know is that the jar
> file is reliably generated, but the .jardesc file fails to appear more often
> than not.

You can access it via Error Log view (Window > Show View > Error Log).
Comment 4 Jon Barrilleaux CLA 2011-08-11 12:33:27 EDT
I restarted eclipse, and cleared the error log and then tried again....

The first time I tried to export a .jar: It created a .jar, but it was the wrong jar in the wrong place.  By best guess is that somehow it used a very old .jardesc (does it cache them somewhere?). Nothing in the error log.

The second time I tried: The wizard (not the error console) complained,  "Resource is out of sync with the file system: '/catools.java.deploy/exe/StatsScanner.win.jar'."  This is the .jar that I was trying to generate.

I tried hitting the wizard "finish" button again: At the top of the wizard it says "The JAR file cannot be exported into itself.", and the finish button is disabled.  I've seen this problem occasionally in the past.  Still nothing in the error console.

At this point it seems that the problem(s) go well beyond not generating the .jardesc file.

--jon
Comment 5 Jon Barrilleaux CLA 2011-08-11 12:42:10 EDT
(In reply to comment #4)
For grins, I tried yet another time: This time I gave the jar file and the jardesc file a completely new name (one that I never used before).  The wizard created both the jar and jardesc. The jar contains what I wanted, plus the contents of an adjacent directory that was not included in the wizard!!!

I deleted the generated jar, and tried running the jardesc: It created the jar again, but this time the jar includes the contents of the jar's destination directory!!!
Comment 6 Jon Barrilleaux CLA 2011-08-11 14:27:59 EDT
Perhaps this is a comedy of errors, so to speak.....

It seems that in spite of checking the box to not include files with compile errors, the wizard tried to anyway, and the wizard popped up a dialog listing the details of what happened (which I ignored because all but one was regarding a compiler warning).  It seems this is why the jardesc only gets generated sometimes (i.e. only when there are warnings, but no errors).

However, this does not explain all the other weirdness I reported in the previous few comments.

Just a thought.....it seems that some eclipse commands pay attention to the current selection as the target of the command, and others do not.  Could it be that the jar wizard is somehow including some arbitrary nearby directory because it happened to be selected when I ran the jar wizard?  If so, there seems to be no indication that such an extraneous directory will be included in the generated jar (i.e. does not show up in the tree view).  

--jon
Comment 7 Dani Megert CLA 2011-08-12 06:00:22 EDT
>By best guess is that somehow it used a very old
>.jardesc (does it cache them somewhere?). Nothing in the error log.
If you just export it uses the values in the dialog from the previous run.

Sorry, but I cannot reproduce any of your problems. If you can't provide a step by step scenario that allows us to reproduce it, then we can't do much.
Comment 8 Dani Megert CLA 2011-10-21 01:33:23 EDT
Nothing we can do without reproducible steps.
Comment 9 Henrik Teinelund CLA 2012-07-27 02:23:35 EDT
I have the same problem in Eclipse Juno. After I got the error "The JAR file cannot be exported into itself." in the export (to Jar-file) dialog, I tried to rename the jar-file slightly. That works the first time you do it. After some experimenting with the export functionality, I had four jar-files. One strange thing is that they all had different size!

I guess some file got corrupt in Eclipse, so I searched in my workspace for some of the jar-file names and one contained them all: .metadata/.plugins/org.eclipse.core.resources/.root/N.tree (where N is a digit). After closing Eclipse and removing the N.tree file I had to import my projects again, but the export to jar works .. ONE time. A second export display the error again.

Hopefully, this information helps in solving this bug.