I prefer to use Intellij IDEA over VS Code for Java development. However, I depend on VS Code for certain things, such as creating a new robot project and installing vendor dependencies. Unfortunately, when I install vendor dependencies using VS Code, IDEA is not able to see them.
Although the IDE cannot resolve the dependencies, gradle can still build successfully, which makes sense since the dependencies have actually been installed correctly, IDEA just doesn’t know that.
If I install the vendordeps via the offline method, it’s not a big deal. The vendor’s jar file is in the 2024 maven folder, so I can simply point IDEA there so the IDE knows about it.
After doing this, the errors go away. The problem comes when I install the dependencies with the online method, where I point to the vendor’s JSON url (e.g. https://software-metadata.revrobotics.com/REVLib-2024.json). When I install dependencies this way with VS Code, I don’t know where the jar files are saved, and so I cannot point IDEA to them. Well, that’s not entirely true. Doing a file search on my system, I found the jar file here:
However, that seems way too obscure to be the best way to fix the issue. It’s in a cache folder (so who knows how long it will stick around) and within a hash folder (SHA1 hash specifically, it seems). Is there a better way to point IDEA to the online dependency than that?
If you put the vendordep .json file into the vendordep folder and reload and build the Gradle project, it should detect the vendordep and install the correct libraries. You can get the .json file directly by right-clicking the URL and select “save link as…” or its equivalent, or just manually create the .json file and then copy/paste the contents when accessing the URL directly.
On the right is the Gradle command that I ran, build. On the bottom is the result, BUILD SUCCESSFUL. On the left is the folder structure, where REVLib.json is in the vendordeps folder. Unfortunately, all the vendor items are still marked red.
You have an alert at the bottom of Intellij saying the Microsoft Defender is blocking the project. Try selecting the alert from the notification tab in the bottom-right to add the folder as an exception?
Thanks for the link! The top reply fixed my problem. Specifically, I clicked the button that reloads all Gradle projects, and the red errors went away.