My source control accidentally deleted the .classpath and .project files generated from my gradle build files, and I cannot find a way to recreate them. I've tried uninstalling and reinstalling the extension, deleting the .settings files, updating my classpaths in the gradle file, and the Ctrl+Alt+U shortcut, and nothing seems to be working. Is there another file I need to delete in order to force this recreation?
Does restarting the VS Code regenerate them?
Nope, nor does restarting my computer.
@fbricon I guess buildship is doing some caching ?
Was able to reproduce by accident. Really hope this gets fixed soon or a solution. FRC competition coming up and really would enjoy not using Eclipse.
@dixonwille I was able to as a workaround reclone my repo to an unrelated directory, and then opened vscode. This generated the files for that repo, and I was able to just copy them over to my existing repo.
The FRC comment is actually really funny. The repo I'm actually working on and had this issue in is the actual WPILib repo, as I'm one of the developers there. And yeah I totally agree with you. Eclipse sucks. VsCode works much nicer, especially now with this working with gradle, and the cpp extension.
@ThadHouse
https://github.com/technomancers/GradleRIO little shameless plug but I am a mentor for team 1758 and wanted to make the build simple for me and them. There was another plugin I based this off of but this one allows way more configuration (hopefully) have not tested the full deploy process yet!
Cloned project worked as mentioned above but I think I messed up the one I was working on. Was changing package name and the such...
Can you try closing vscode, deleting vscode's workspace storage directory at %APPDATA%\Code\User\workspaceStorage\ and then reopen your gradle-based project?
Did everything except ask if I want it automatic, manual, or disabled. Thanks! I did delete all the copied files from that directory before trying if that mattered.
@dixonwille I'm confused, are you saying deleting workspaceStorage worked?
Yes, it worked. Sorry for the confusion.
So I:
Can you maybe attach a sample project, see if we can reproduce the issue?
https://github.com/technomancers/2016Spike this was the exact project this was happening in. I assume you are using Windows since you used %APPDATA%. I am running Windows 10 Pro if it means anything. I am currently on an Insider build but this was happening on the Latest release as well (OS Build 14393.576). I do have developer mode enabled and Bash on Windows enabled. Don't see why they would affect it because VSCode and Java are installed on the Windows side. Hope this helps. Let me know if there is anything else I can do?
I can confirm this. Yesterday, I copied my sample project for an application plugin and changed some package/class names and modified gradle files. After I deleted the ".classpath", ".project" files and "bin", ".settings" and ".gradle" folders they were not auto generated and I wasn't able to use intellisense or other thing on my java files in that project (I was getting "Can't read root project location for project located at" error, I managed to get rid of it but the plugin was still not functioning). So I had to recreate another project with exact same structure in VS Code from scratch.
It looks like is not only related to gradle, i can confirmed this problem is also happening for regular maven projects:
Visual Studio Code: Version 1.14.1
OS: Ubuntu 16.04.2
The following output is shown:
[Error - 3:46:40 PM] Jul 14, 2017 3:46:38 PM Problem importing to workspace
The project description file (.project) for 'demo' is missing. This file contains important information about the project. The project will not function properly until this file is restored.
org.eclipse.core.internal.resources.ResourceException: The project description file (.project) for 'challenge-realtime-statistis' is missing. This file contains important information about the project. The project will not function properly until this file is restored.
at org.eclipse.core.internal.localstore.FileSystemResourceManager.read(FileSystemResourceManager.java:901)
at org.eclipse.core.internal.resources.SaveManager.restoreMetaInfo(SaveManager.java:904)
at org.eclipse.core.internal.resources.SaveManager.restore(SaveManager.java:774)
at org.eclipse.core.internal.resources.Project.open(Project.java:1056)
at org.eclipse.core.internal.resources.Project.open(Project.java:1102)
at org.eclipse.jdt.ls.core.internal.managers.MavenProjectImporter.updateProjects(MavenProjectImporter.java:109)
at org.eclipse.jdt.ls.core.internal.managers.MavenProjectImporter.importToWorkspace(MavenProjectImporter.java:92)
at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.initializeProjects(ProjectsManager.java:75)
at org.eclipse.jdt.ls.core.internal.handlers.InitHandler$1.run(InitHandler.java:108)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
Most helpful comment
Can you try closing vscode, deleting vscode's workspace storage directory at
%APPDATA%\Code\User\workspaceStorage\and then reopen your gradle-based project?