Hello CD friends,
In my team’s code we use the CTRE Phoenix libraries in our drive train code, and a lot of motion control is handled with it. In order to build the code, I needed to install the Phoenix dependencies in the WPI VSCode IDE. I followed the instructions for installation, and everything seemed to be installed correctly. The Phoenix.json was copied from the user/Public/frc2019/vendordeps folder to my repository vendordeps folder, and I can confirm that the file is there.
The problem is that, for whatever reason, despite having the dependency file, Java cannot recognize that the com.ctre import. I uninstalled the Phoenix Framework and did a reinstall, with no new results.
My teammates also installed these dependencies, and it worked for them. Any ideas for how to fix this? I included a screenshot of the error that my IDE is throwing in the file itself. I would include the whole stack trace, but it’s very long.
I am running on Windows 10 Home, version 1803, OS Build 17134.523
Thanks in advance.
It looks to me like you’ve created a new project and you need to add the vendor libraries to the project. Open the command palette (Shift+Command+P) and select WPILib: Manage Vendor Libraries. Choose install offline and then you should see the CTRE library there since you’ve already updated the JSON. Select the library and it should rebuild your project and make the issue go away.
Thanks for the response. Just to clarify, this project was ported over from the alpha version of the WPILib VSCode. I have added that .json file to the project, but despite that, it still isn’t recognizing the libraries. It was that not working that led to me creating this topic. Now I’m just trying to figure out how to get it working.
Porting from alpha is definitely unrecommended. It’s not surprising it’s not working now.
You should create a new project and copy your source code into the new project.
For posterity, these are the instructions to be followed after the installer and rio-prep,
Thanks for the suggestion. I’ll talk with my team about porting the code over to a new project, because there are so many files in our system that it would take quite a while to copy everything over to new files, and we’d have to manage inconsistencies in our shared repository.
Just a comment, my other teammates’ code was also ported over from alpha, but their code is functioning properly. They used the WPI VSCode to import the vendordeps, and they now develop the same code in IntelliJ. If this were a code structure problem, then why is it only affecting my code?
Alright, new clarification. Our code was originally in an alpha project, but it was redeveloped in a new project. That’s already been done. It seems that this issue is specific to my computer.
The issue has been solved. Turns out WPI VSCode was doing something stupid to my build file and we fixed it by magic so yeah problem solved
I’m actually having a similar problem where I’ve copied the json, but VS Code won’t find the offline library…
Can you clarify what you mean? Are you seeing squiggly lines? The build fails? Something else?
Yeah I see the squiggly lines under the imports. I tried moving the json and restarting VS Code, but when I select the option for installing offline, it states that “No new dependencies [are ]available”. Thanks for your help!
Did you run the offline installers for the dependencies you want to add? Only then do they appear in that list. See http://wpilib.screenstepslive.com/s/currentCS/m/java/l/1035724-3rd-party-libraries
Yeah I’ve already been able to assign ID numbers using the Phoenix Tuner, and the json is added along with it. I can try and try updating the json again, but other than that, I have no idea what to do. I’m pretty familiar with IntelliJ, but I haven’t worked too much with VS Code
The json definitely should show up in the manage offline dependencies list then. You should not move the json file in the global vendordeps location, that’s where vscode looks to find it to add. Vendor dependencies have to be added to each project individually (which copies that json file from the global location to the project so Gradle [and vscode] can find it).
Yeah I copied the json file into the vendorderps file created within the VS Code repository. I tried re-copying the json, but that didn’t fix it.
Never mind! I looked under “Manage current libraries” instead of installing it offline, and it seemed to have fix it. Thanks for all of your help!!!