I just recently imported our 2021 program in the 2022 version of WPILib in order to test on a swerve chassis bot. Last year’s code relies heavily on the FRCTeam2910 Common Code libraries as we are using the Mk2 swerve modules. I imported the common library as a git submodule to the imported project, yet I am still getting errors. I have also gotten errors when trying to add the “compile project(’:common’)” dependency on the common library to the build.gradle file, as well as the “include ‘:common’” to the settings.gradle file.
Would help if you shared what the error was
Whenever I try to build the code, the I get this output in the terminal:
The terminal process "cmd.exe /d /c gradlew simulateExternalJavaRelease -Dorg.gradle.java.home="C:\Users\Public\wpilib\2022\jdk"" terminated with exit code: 1.
Although from what I understand, I believe I am getting a compilation error due to the unresolved import (I also get the following output in the terminal)
Compilation Error! GradleRIO detected this build failed due to a Compile Error (compileJava) FAILURE: Build failed with an exception.
There should be more output above that line.
Got it! Is this it?
C:\Users\PC\Documents\GitHub\swerve-chassisbot-2022-Imported\src\main\java\frc\robot\commands\DriveCommand.java:10: error: package org.frcteam2910.common.math does not exist import org.frcteam2910.common.math.Vector2;
Yup, that’s it! That’s saying that class doesn’t exist. As this is a subproject, I suspect the problem is in how you’re adding it, which matches what you stated in your original post, so you’re definitely on the right track.
WPILib updated to Gradle 7 for this year, which has a number of changes over older versions. The most relevant is how subprojects are imported. I suspect you just need to update how you’re doing that. That should be easily google-able, so I’ll leave that as a learning task.
There have been numerous posts here on CD in just the last week or two regarding that common library, so that might be a good start.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.