Just installed and set up VS Code for build season use, but my projects are having issues. Both old projects imported from git and new projects made w/ the wpilib extension give the “classpath is incomplete” error upon opening.
Edit: Win 10, Java
Just installed and set up VS Code for build season use, but my projects are having issues. Both old projects imported from git and new projects made w/ the wpilib extension give the “classpath is incomplete” error upon opening.
Edit: Win 10, Java
Hello,
To confirm, you’re using Java? Also which operating system are you using?
If Java, I would check a few things:
JAVA_HOME
setting? WPILib instructions are here.
build.gradle
file.Let me know if that works / doesn’t work. Best of luck!
Kenneth
Assuming Kenneth’s suggestions don’t work:
Since this is (presumably) your first build, it sounds like you don’t have the dependencies yet. You can “force” this.
At your command line (on your computer or the terminal in VS Code), type:
./gradlew build
This will get everything on your machine which should make the classpath happier.
Did you use the offline installer for windows or the offline files for another platform? The offline install ensures you have all the dependencies you need. Knowing which OS you are using and how you installed vscode would help diagnose the problem.
My newly made projects seem to be working now (?) but our last year’s code, imported from git, is missing any build.gradle. Rather, it has build.xml (not sure if that was another option at some point) which vs code is not particularly happy with.
Did you use vscode-wpilib’s project import/upgrade wizard? You can’t upgrade a project from last year in place, you have to import your previous (pre-2019 Eclipse) project into a new (2019 GradleRIO) project.
After attempting to build one the projects it said “‘gradlew’ is not recognized as an internal or external command, operable program or batch file.” . I’m beginning to think my install messed up
That error means your project doesn’t have a gradlew.bat script in it. Have you tried creating a brand new project? Again, you can’t just clone an Eclipse project and have it work, you have to either create a new project (using the wpilib extension new project command) or run the import/upgrade wizard to create a new vscode/gradle project from your old Eclipse project.
Did you use the offline installer to install vscode and everything else?
The missing gradlew issue persists, even though I used the WPILib installer for everything
I do a complete uninstall/reinstall of the WPILib installer stuff
gradlew still missing
-Here's the actual log from the terminal:
-Executing task: gradlew build --offline -Dorg.gradle.java.home="C:\Users\Public\frc2019\jdk" <
-'gradlew' is not recognized as an internal or external command,
operable program or batch file.
Not sure if you have already tried this but I believe on Windows you would need to do somthing along the lines of:
.\gradlew.bat build --offline -Dorg.gradle.java.home=“C:\Users\Public\frc2019\jdk”
Not recognized as a command
Can you explain what you mean by “you didn’t do it right for git projects”. If the importer isn’t run, there isn’t any gradlew generated to run.
Going back to your initial post, even new projects created using the wpilib extension are missing gradlew.bat?
Initially yes (though it’s possible they were there and I had got confused) but after reinstalling everything the new projects have the necessary Gradle files. But it appears that Gradle is not properly set up on my system (at least I think that is the issue) since any Gradle commands are unrecognized (whether from VS Code attempting to build, or from system command prompt/powershell
I had simply imported it git, wrongly assuming it would give it the same gradle treatment as the eclipse importer
What directory are you trying to run .\gradlew
in when you try to run it from the command line? Is it the project directory? Is there a gradlew.bat
file in that directory? Note when you open a project in vscode you need to open the root of the project (the directory where gradlew.bat is). Does your project directory have spaces anywhere in the path?
SOLUTION: After getting some help on discord, we discovered the issue was a corrupt gradlew.bat file. Replacing its contents with this: https://github.com/wpilibsuite/vscode-wpilib/blob/master/vscode-wpilib/resources/gradle/shared/gradlew.bat solved the issue.
Side note for those who stumble accross this thread with the classpath issue:
Verify that your project has all necessary gradle files and insure you open that project folder directly, rather than open a folder containing multiple projects