Community
Participate
Working Groups
Build Identifier: 20110916-0149 When a Java (or Groovy) file is located outside the build path of a Dynamic Web Project, some kind of operation will make it disappear from the Project Explorer. That file won't be reachable in any way then, at least with the Project Explorer. You must use the Package Explorer or Ctrl+Shift+R to get to it again. To make the file visible again in the Project Explorer, you have to disable the "Enhanced Java Rendering for Web" content provider. If you are wondering why one may put a Java file outside the project build path, the answer is that there may be other files with Java or Groovy nature that are usually located outside the build path and are used for some other facilities. In particular, this problem was tracked down after the reporting of a bug in Spring Tools Suite integration with Gradle (see: https://issuetracker.springsource.com/browse/STS-2278, especially Kris De Volder's comment of 18/nov/11): in Gradle projects, there are Groovy files (usually build.gradle or settings.gradle) that are located in the root of a project (which may be a Java project or a Dynamic Web Project) and that are handled by the Groovy editor (because their content is actually Groovy code). This bug is making those file "randomly" disappear from the Project Explorer (although we discovered it does not actually happen "randomly"). Reproducible: Always Steps to Reproduce: Reproduced with a just-downloaded Eclipse IDE for Java EE Developers: 1. import the attached project in a fresh new workspace 2. double click on the MyClass.java located at the root of the project, so that the Java editor is opened 3. now try to change the build path of the project in some way: for instance, you may remove or re-add the JUnit library from the project 4. MyClass.java disappears from the Project Explorer! 5. now click on the down-arrow in the top-right corner of the Project Explorer view, then Customize View... | Content and disable the "Enhanced Java Rendering for Web": the file will appear again in the Project Explorer
Created attachment 207420 [details] Zipped project to reproduce the problem
It's important to point out that, although the original problem in STS was reported with a .gradle (and so a groovy file). We have reproduced it with plain .java files. Conditions necessary to trigger the bug seem to be the following: - WTP project - a 'java-like' file placed outside the project's classpath. - this file open in the editor. - a refresh of some kind causing the project explorer to update its contents. - "Enhanced Java Rendering for Web" content provider active Hypothesis (not sure this is really what is happening, just my guess): "Enhanced Java Rendering for Web" is removing the file from the view because it mistakenly believes it is on the classpath when it is open in the editor. Maybe this is due to some kind of interference by the Java editor having triggered a reconcile.
Any news for this? It's very annoying when working with Gradle files...
This still happens in 2019-12.