In our projects we make use of the Gradle Release Plugin which takes care of the version upgrade, tagging, and several Git tasks during a release. With the 2.7 version of the Spring Boot Gradle Plugin, the following task configuration worked:

tasks.bootBuildImage {
    // Default image name for snapshots is required since Spring Boot 2.6
    imageName.set("my-snapshot-repo/my-image:${project.version}")

    doFirst {
        // Defer evaluation of project version so that the correct version is used during a release
        if (version.toString().endsWith("SNAPSHOT")) {
            imageName.set("my-snapshot-repo/my-image:${project.version}")
        } else {
            imageName.set("my-release-repo/my-image:${project.version}")
        }
    }
}

So basically we set the image name just before the task is executed so we get the correct project version which changes during the release process. However, this is no longer possible. After updating to Spring Boot 3.0.1, builduing the image fails with this error:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':bootBuildImage'.
> The value for task ':bootBuildImage' property 'imageName' is final and cannot be changed any further.

Comment From: wilkinsona

You shouldn't really change the value of a task's input once its execution has begun. This is now enforced as imageName is declared as a Property. You can still achieve your goal by setting the property with a Provider. The provider is called lazily, and only when the property's value is needed. By this time the project's version should not be subject to change. This will allow you to simplify your build logic a little, something like this:

```groovy tasks.bootBuildImage { imageName.set(provider { version.toString().endsWith("SNAPSHOT") ? "my-snapshot-repo/my-image:${project.version}" : "my-release-repo/my-image:${project.version}" }) }