For some reason Eclipse has started hiding the 'src' folder in some but not all of my projects and I would like to get it back.
The files under src are still available under other generated views such as Java Resources and Deployed Resources but the actual 'src' folder is hidden from all views including Project Explorer, Navigator, and Open Resource (Ctrl+Shift+R). Not being able to navigate via Open Resource is particularly annoying.
Does anyone know why the folder has disappeared, and how to get it back?
I have a feeling I changed a setting somewhere a while ago not realising the side effects but am really struggling to how to undo this change. Other people on my team are unaffected so I assume it is a setting somewhere on my machine.
The projects in question are all Spring Maven projects using m2e. The two affected projects are both webapp/WAR projects but other webapp projects are unaffected.
Things I've tried to whittle down the cause:
Software details are:
src is where Java IDEs (at least Eclipse and NetBeans) put the source files, it is pretty much standard, and the hierarchy of the folder inside it has to match your Java packages names.
The src stands for source. The /src folder comprises of the raw non-minified code. The /src folder is used to store the file with the primary purpose of reading (and/or editing) the code. The /src folder contains all the sources, i.e. the code which is required to be manipulated before it can be used.
To view the project explorer, click on Window menu then, click on Show View and select Project Explorer. There is simpler way to open project explorer, when you are in the editor press alt + shift + w and select project explorer.
right click on project
select properties
select java build path
goto source tab
click add folder
select your source folder (src/main/java
)
I would also add src/main/resources
, src/test/java
, src/test/resources
Answering my own question to help out anyone else who gets this since it has wasted a couple of days of my time figuring out the cause.
Someone on my team accidentally checked in a .git folder somewhere deep under src/main/webapp which triggers the problem when importing the project. Removing the stray .git folder fixes the problem.
I assume this confuses the EGit plug-in which ships with the Java EE version of Eclipse. We don't use Git so I had no reason to suspect it as the cause of the problem. No one else on the team saw the problem since it only shows up when re-importing projects.
Hope to submit a bug report to the EGit project at some stage since I can't think why it should ever hide the 'src' folder like this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With