Custom 3rd Party Library Development with Gradle and JitPack

Last year, we developed a swerve library, 3534Swerve.

I am unsure how to update the library to work in 2024.

Simply changing the year/version of gradlerio in the build.gradle file and updating the vendor deps, I’m getting an error that doesn’t make much sense.

Before we go down a rabbit hole of trying to solve that error, is there a straightforward method to update very simple Gradle builds that are already setup with jitpack?

If not, can someone give me some tips of exactly what files need to be updated as far as Gradle goes for the change from 2023 to 2024, so we can start resolving errors in the code for the updated wpilib and 3rd party libraries?

Thank you in advance.

Each gradlerio version is linked to a specific version of gradle. You’re probably seeing an error about a “FlowControl” class not being found. You need to upgrade the gradle version. Its not just a few simple commands to run to do that, because you can’t actually run any commands due to the break. I’ll try to write up some instructions how to manually work around it.

BTW this is why the project importer actually creates a whole new project, rather then just changing an existing one.

The gradle version isn’t right for 2023 either. You may have just gotten lucky last year.

Correct. I get the following error to be exact, for anyone searching in the future.

FAILURE: Build failed with an exception.

* What went wrong:
com.google.common.util.concurrent.ExecutionError: java.lang.NoClassDefFoundError: org/gradle/api/flow/FlowAction
> java.lang.NoClassDefFoundError: org/gradle/api/flow/FlowAction

* 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.

* Get more help at https://help.gradle.org

The gradle version used now that it’s working anymore is version 7.3.3, for anyone who is curious.

After importing last years robot code with the project importer, I see the gradle version is now 8.5.

I tried using the project importer on our library, but that failed, probably because the build.gradle file is quite different (or because the build.gradle file is from before 2020?).

Either way, I need to figure out how to update gradle from 7.3.3 to 8.5 OR build the library as a vendor dependency some other way.

If you’re willing to do a write up, I’m sure I am not the only one who could benefit from the documentation of the upgrade process.

Your project is using the gradle wrapper, so (assuming you use ./gradlew, not gradle) your gradle version can be changed here: 3534Swerve/gradle/wrapper/gradle-wrapper.properties at master · HOC-Team-3534/3534Swerve · GitHub

Yes. In addition, the build.gradle file syntax may need to be updated. Compare versions of the repository to see what I changed (Once I push changes of course). Hopefully, someone in the future benefits from this issue we have had.

Just copying that file might not get all updates. The instructions are here: Gradle Wrapper Reference

I believe in this case, the instructions would suggest to run ./gradlew wrapper --gradle-version 8.5. Compared to what I did manually, this is what it changed, for anyone who is curious.

image

I would follow the instructions here if I did it again. Thank you for the link. It’s here now if someone else needs it in the future.