Strange Build Error

I copied my 2022 robot program (which builds and deploys correctly) to a new folder for starting 2023 work. I changed the package statement in the code files to reflect the new program name. I have done this before successfully to start a new year, but this time around, when I try to build the new project an error occurs on a seemingly random line in the build.gradle file:

Executing task: gradlew build“C:\Users\Public\wpilib\2022\jdk” <

FAILURE: Build failed with an exception.

  • Where:
    Build file ‘C:\Users<user>\workspace\FRC Java\Robot23B\build.gradle’ line: 118

  • What went wrong:
    A problem occurred evaluating root project ‘Robot23B’.

java.lang.NullPointerException (no error message)

On lline 118 in build.gradle there is an error highlight with this text:

Could not run phased build action using connection to Gradle distribution ‘’.
Build file ‘C:\Users<user>\workspace\FRC Java\Robot23B\build.gradle’ line: 118
A problem occurred evaluating root project ‘Robot23B’.Java(0)

You need to update gradle. It needs to be 7.5.1. Also you need Java 17, which is not going to be part of the 2022 installer

I assume you mean 2023 installer. Note I am still running as 2022 and my 2022 projects build without incident. This problem project is just a copy of 2022 that will be used for beta test, but beta is not yet installed. build.gradle GradleRIO version is still 2022.4.1. I’m not clear why the gradle update is needed if I am not yet working under 2023 wpilib.

You said getting started for 2023, so I had assumed you had updated build.gradle for 2023. Sorry.

When you copied it, did you copy the .gradle folder? Iirc that folder is not path safe, and will break. Also try stopping any daemons, and maybe a reboot.

If neither of those work, run with --stacktrace

I did copy .gradle folder. Deleted it and rebooted. Problem persists. I can run with --stacktrace or --debug or --scan but the results tell me nothing I can use. What would be useful to determine what is wrong?

Would starting over and not copying .gradle folder be a good option?

Yes, that would probably work. Also make sure you remove any build or bin folder as well. Basically if it doesn’t go in git, don’t copy it. You can also try deleting your .gradle folder in your home directory, but you’ll lose some caches, and the next builds you do of everything will require internet.

So starting over was successful. I think I created the problem in the way I changed the package for the project. Thanks for the help.