How to upgrade grade 4 project to grade 8 project?

I’m trying to refresh this small SparkJava project webmf-groovy-spark that was originally built with gradle 4.10.2 and OpenJDK 8.

What is the easiest way to convert this project to the more current tools with gradle 8.7 and compatible Azul OpenJDK 21.0.3? I did search for a solution but didn’t find any, and I am beginning to think there is none.

I am deducing that I would just have to delete all the existing files, and just start from scratch by generating the new files with gradle init. This doesn’t seem all that intuitive. If there’s an easier way to convert this, that would be great.

That is not a Gradle 4 project, but a Gradle 2.11 project.

Usually, to update the Gradle version of a project you would update to the latest patch version in the same major version, fix all deprecation warnings, then update to the latest patch version in the following major version, again fix all deprecation warnings, and so on, on the way also reading and considering the upgrade notes in the user guide.

But as your project is really trivial and only has 13 lines in the build script, it is probably really easier to just start over.

So just

  • change “2.11” to “8.7” in gradle/wrapper/,
  • replace settings.gradle by settings.gradle.kts with content = "groovy"
  • replace build.gradle by build.gradle.kts with content
    plugins {
    application {
        mainClass = "Service"
    repositories {
    dependencies {
  • and finally run ./gradlew wrapper to update the wrapper files to the latest version

Now you have a build that does exactly the same as before but running on Gradle 8.7.

Thank you for the advice. Yeah, I think, just manually deleted all the auto-gen files and started fresh. Initially, I just wanted to get exposure to the tools. It seems more complex to keep up with changes.

Just follow the four steps I gave you, nothing more to do, nothing more to delete.