Gradle plugin issues

Gradle plugin is having a lot of issues. Displays this error message when I attempt to build in it. “cmd.exe /d /c gradlew build -Dorg.gradle.java.home=“C:\Users\Public\wpilib\2022\jdk”” terminated with exit code: 1.

Our code:

Thanks for linking to your code, but there should be a lot more to the error message than that… you will need to scroll up in the console window to see it. That line is just saying that Gradle couldn’t build your code. Most likely it’s a compilation error.

This is the entire error message I get.

Executing task: gradlew build -Dorg.gradle.java.home=“C:\Users\Public\wpilib\2022\jdk” <

FAILURE: Build failed with an exception.

  • Where:
    Build file ‘C:\Users\delan\Downloads\2021-mecanum-code-SignleJoystick-main\2021-mecanum-code-SignleJoystick-main\2021-Mecanum-Code-SingleJoystick\build.gradle’ line: 22

  • What went wrong:
    A problem occurred evaluating root project ‘2021-Mecanum-Code-SingleJoystick’.

Could not find team number. Make sure either one is passed in, or the team number is set in the wpilib_preferences.json file. You can also use getTeamOrDefault(number) to pass in a default team number instead of getTeamValue

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

BUILD FAILED in 3s
The terminal process “cmd.exe /d /c gradlew build -Dorg.gradle.java.home=“C:\Users\Public\wpilib\2022\jdk”” terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.


This seems like a pretty solid description of the symptom. While i’m not sure how you’re in a scenario where team number has not been set, have you tried setting it to see if that makes the issue go away?

How did you create the project? I notice its missing the .gitignore file, and also missing the .wpilib folder. The .wpilib folder is what contains the perferences file that contains the team number.

I fixed the team number, thank you so much for that. We looked for it before but couldn’t find it, so that’s a big help. But more error messages popped up. I don’t understand what “check if you saved” means. If you mean if we saved the code, we have done that. I also saved it again just in case that was the issue. Nothing changed.
Again, this is the whole error message.

Task :compileJava FAILED
C:\Users\delan\Downloads\2021-mecanum-code-SignleJoystick-main\2021-mecanum-code-SignleJoystick-main\2021-Mecanum-Code-SingleJoystick\src\main\java\frc\robot\commands\AutonomousCommand.java:51:
error: cannot find symbol
return System.currentTimeInMillis() >= endTime;
^
symbol: method currentTimeInMillis()
location: class System
1 error
Compilation Error!
GradleRIO detected this build failed due to a Compile Error (compileJava).
Check that all your files are saved, then scroll up in this log for more information.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:compileJava’.

Compilation failed; see the compiler error output for details.

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

BUILD FAILED in 3s
1 actionable task: 1 executed
The terminal process “cmd.exe /d /c gradlew build -Dorg.gradle.java.home=“C:\Users\Public\wpilib\2022\jdk”” terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

System.currentTimeInMillis() is not the right method name. Get rid of “In”

No prob! That error now looks like it’s complaining about code syntax. Here’s how to read it:

Specifically, in that file AutonomousCommand.java, near line 51, there is some “symbol” (variable, class name, method name, etc) which java parsed, but did not understand.

You’ll want to go to that file and check around that area for syntax errors, undeclared variables, etc.

General software mentality I like to encourage folks to keep: If you make a change, and an error changes, that’s progress. Don’t get discouraged about the fact another error came up. Keep solving over and over, you’ll get through them all eventually.

We just did it through the WPIlib visual studio. I wasn’t on the team at time of creation though. I don’t know what a .gitignore file is, as we are not using git. We did fix the team number though. I can see the preferences file in there now.

Thank you so much! That was the main problem fixed. As always with robotics there are other issues, but this seems to be the answer to this particular question.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.