Bug 245779 - [buildpath] "java build path" jar fentries are "lost" without re-import
Summary: [buildpath] "java build path" jar fentries are "lost" without re-import
Status: VERIFIED DUPLICATE of bug 244849
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 M2   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-30 20:47 EDT by Peter Kennard CLA
Modified: 2008-11-21 09:50 EST (History)
2 users (show)

See Also:


Attachments
zip file of repeatable test case (9.75 MB, application/octet-stream)
2008-09-14 17:30 EDT, Peter Kennard CLA
no flags Details
Improved reproduceable sample with no inital build errors (8.84 MB, application/octet-stream)
2008-09-19 08:54 EDT, Peter Kennard CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Kennard CLA 2008-08-30 20:47:15 EDT
Build ID:  I20080617-2000

Steps To Reproduce:
The entries are unaltered in .classpath, but they are not "found"

1. have a number of eclipse "javanature" projects in one workspace.

2. have a number of them use jars specified in the .classpath in a common directory set in the "java build path" in .classpath referenced by a "classpath variable" - 
ie:
	<classpathentry kind="var" path="MY_JAR_HOME/my-interfaces.jar" sourcepath="MY_JAR_HOME/my-interfaces-src.zip">
		<attributes>
			<attribute name="javadoc_location" value="jar:file:MY_JAR_HOME/my-interfaces-doc.zip!/"/>
		</attributes>
	</classpathentry>

3. have the java projects build with no errors using these jars.

4. delete all the jar files in the common jar directory
   referenced by the classpath variables
   (for reference they are built by an ant build 
     script which will do this during a "clean" target)
   Note: the common library directory is in the workspace.

This will cause a subsequent javanature build to properly give missing classpath entry errors like:

"Description	Resource	Path	Location	Type
Project 'GLMap' is missing required library: 'C:\eclipse-work\myJars\my-interfaces.jar'	XXXProject		Build path	Build Path Problem"

5. Rebuild the jars with an ant script or otherwise put in new copies. (note overwriting the files or "touching" them without deleting first them does not cause this problem)

6. "clean all projects"
  (the missing build path errors remain after clean rebuild)

7. "refresh" all projects, and then clean all projects
  (the missing build path errors remain after clean rebuild)

8. close and reopen eclipse
  (the missing build path errors remain after clean rebuild)

At this point the *only* way I have found to clear the missing build path errors is to re-import the projects from source control, (one must leave the jar files where they are) or, to delete and re-create all the classpath entries using "add-variable->extend".


More information:
I am using the latest subclipse and no other plugins outside the eclipse distribution.  I am using the sun java jdk.
Comment 1 Jerome Lanneluc CLA 2008-09-02 07:32:30 EDT
Step 7 made the errors go away for me. Note that step 6 will not refresh external jars. It will just delete the contents of the output folders.

So do you have more details on how to reproduce this problem? Maybe attaching an example project with an example ant script that reproduces the problem would help.
Comment 2 Peter Kennard CLA 2008-09-14 17:30:17 EDT
Created attachment 112520 [details]
zip file of repeatable test case

see comment in bug - zip file contains workspace and projects which will reproduce the problem.
Comment 3 Jerome Lanneluc CLA 2008-09-15 06:29:27 EDT
Sorry, but I still cannot reproduce. Here are the steps I followed:
1. Unzipped zip file from comment 2 to "C:\"
2. Started SDK I20080617-2000 with "-data C:\bug245779workspace"
3. Selected both projects and hit refresh (F5)
4. Noted that "pktest" had 2 build path errors:
Description	Resource	Path	Location	Type
Project 'pktest' is missing required library: 'C:\Tomcat6.0\lib\catalina-ant.jar'	pktest		Build path	Build Path Problem
Project 'pktest' is missing required library: 'C:\Tomcat6.0\lib\servlet-api.jar'	pktest		Build path	Build Path Problem
5. Within the Package Explorer, expanded "airoJars" and deleted all .jar and .zip files
6. Selected "pktest" and hit refresh (F5)
7. Noted that "pktest" had several build path errors because of the deleted jars
8. Unzipped all .zip and .jar files from "bug245779workspace\airoJars\" to "C:\bug245779workspace\airoJars"
9. In Package Explorer, selected "pktest" and hit refresh (F5)
10. Noted that the errors from step 7 were gone

Can you please follow accurately those steps and tell me if you can reproduce?
If your steps are different, what is the difference?
Comment 4 Peter Kennard CLA 2008-09-15 07:30:30 EDT
Pardon missing classpath items. They must have been from CATALINA_HOME

From eclipse, you have to,

- unzip the test workspace.

- before youopen the workspce externally from eclipse so you can re-import the project using eclipse via "subclipse" and not alter the state of the unzipped workspace, (pardon: delete the existing ".svn" directory) and check the project "airoJars" into subversion.

- delete the unzipped workspace and unzip it again if you checked in the project "airoJars" using eclipse/subclipse or in-situ from command line.

- After opening the freshly unzipped original workspace with a succesful build, in the package explorer, right click on the project "airoJars" and "delete" the *PROJECT* from the workspace. (as opposed to deleting only it's contents), make sure the "delete project contents from disk" check box is selected.

- now "clean" all projects (you will get missing library errors)

- close eclipse.

- re-open eclipse and re-open the workspace
    you will now get "missing required library" errors after the build.

- *Import* the project "airoJars" from Subversion using eclipse/subclipse. (from where you previously checked it in) ie: right click on package explorer->Import, SVN->"Checkout project from SVN" (it will import and put the project "airoJars" back to where it was) 

- At this point refresh and clean will not clear the missing required library errors.
 
NOTE: it was only by following this exact sequence I was able to reliably replicate the funky state where a rebuild will not clear the errors with this culled out version of our workspace.

Comment 5 Jerome Lanneluc CLA 2008-09-19 07:04:36 EDT
Sorry Peter, I keep re-reading your explanations but I don't see how I can reproduce the problem. So could you please start from the steps I gave you in comment 3, and tell me if those steps reproduce the problem for you. 

If they don't, please rewrite those steps so that I can reproduce the problem.
Comment 6 Peter Kennard CLA 2008-09-19 08:54:22 EDT
Created attachment 113005 [details]
Improved reproduceable sample with no inital build errors

see added comment on how to reproduce bug
Comment 7 Peter Kennard CLA 2008-09-19 08:59:33 EDT
> Sorry, but I still cannot reproduce. Here are the steps I followed:
> Can you please follow accurately those steps and tell me if you can reproduce?
> If your steps are different, what is the difference?

I attached a second zip file where the initial error has been corrected.  The only difference is I added the missing jar file so there are no initial build errors.

On differences to reproduce See below edited procedure:

> 1. Unzipped zip file from comment 2 to "C:\"
> 2. Started SDK I20080617-2000 with "-data C:\bug245779workspace"
> 3. Selected both projects and hit refresh (F5)

> 4. Noted that "pktest" had 2 build path errors:
> Description     Resource        Path    Location        Type
> Project 'pktest' is missing required library:
> 'C:\Tomcat6.0\lib\catalina-ant.jar'       pktest          Build path      Build
> Path Problem
> Project 'pktest' is missing required library:
> 'C:\Tomcat6.0\lib\servlet-api.jar'        pktest          Build path      Build
> Path Problem

#4 has been corrected with the new zip file.

> 5. Within the Package Explorer, expanded "airoJars" and deleted all .jar and
> zip files

Step #5 should be:

    #5a From the package explorer, highlight the project airoJars
        and *right click* on the project airoJars.
    #5b from the resulting popup context menu select "X Delete"
         a confirmation requestor will come up.
    #5c select the checkbox 
        [x] Delete project contents from disk (cannot be undone)  
    #5d Click [OK]

> 6. Selected "pktest" and hit refresh (F5)
> 7. Noted that "pktest" had several build path errors because of the deleted
> jars

At this point with above procedure the project airoJars does not exist, and the "problems" window shows the (10) required libraries not found errors.

> 8. Unzipped all .zip and .jar files from "bug245779workspace\airoJars\" to
> "C:\bug245779workspace\airoJars"

NO - do not do this - Step #8 should be

    #8a - Right click on package explorer
    #8b - Select "Import"
           a resultant requestor pops up.
    #8c - Select "General->Existing projects into workspace"
    #8d - click [Next]
           a resultant requestor pops up
    #8e - Select "(*) Select Archive File"
    #8f - browse to and select the zip file you unpacked the 
          sample workspace from. "C:\bug245779example2.zip"
    #8g - In the project window select *ONLY* the project "airoJars"
           and click on "Finish"

> 9. In Package Explorer, selected "pktest" and hit refresh (F5)
> 10. Noted that the errors from step 7 were gone

At this point all the required jar files are present on the file system, but instead of #10 the libraries are not found even after repeated refresh and rebuild operations and afre closing and reopening eclipse.

Note: there are other scenarios that have caused this to occur but the delete and re-import procedure always causes the problem here.

Peter K.
Comment 8 Jerome Lanneluc CLA 2008-09-19 10:03:17 EDT
(In reply to comment #7)
Thanks Peter. I was able to reproduce with those steps.
The good news is that it is fixed with 3.5M2 (ie. I can no longer reproduce with I20080918-0100).
Comment 9 Jerome Lanneluc CLA 2008-09-19 10:04:53 EDT
After more investigation, it appears that the fix for bug 244849 actually fixed this problem (ie. without the fix for bug 244849, I can reproduce the problem, but with the fix for bug 244849, I cannot reproduce the problem).

So I'm closing this bug as a dup of bug 244849.

*** This bug has been marked as a duplicate of bug 244849 ***
Comment 10 Peter Kennard CLA 2008-09-19 11:55:37 EDT
This is good  it has been one of those things like windows rearraging icons :)
Comment 11 Olivier Thomann CLA 2008-10-28 13:49:56 EDT
After step 10, no errors are reported.
Verified for 3.5M3 using  I20081027-1800