If I disable the time property, the Gradle BuildInfo task indicates that it is up to date even when the project version number changes.

In our configuration, we have changed the build info configuration to exclude the time property as suggested in the documentation:

springBoot {
    buildInfo {
        properties {
             time = null
        }
    }
}

Now, when we alter the project version number, this task always indicates that it is up to date and so the incorrect version number is included in the build-info files. Looking at the code, I suspect the problem is that the BuildInfoProperties class has a null value for the version number by default, and so each time the input is checked, Gradle only sees this null value. It never changes to reflect the changing version number.

Using version 2.2.2.RELEASE of the plugin.

Comment From: ddebree

Just an aside for anyone coming across this issue. The one workaround I found for this issue is to force the version field in the properties:

springBoot {
    buildInfo {
        properties {
            time = null
            version = project.version
        }
    }
}

Comment From: wilkinsona

This sounds like a duplicate of https://github.com/spring-projects/spring-boot/issues/12266. #12266 was fixed in 2.0.0 and an integration test that verifies that the task is not up-to-date when the project's version changes was added. That test passes and is run against all supported versions of Gradle so it's not clear to me what the problem might be.

@ddebree To allow us to investigate further, please provide a minimal sample that reproduces the problem that you have described.

Comment From: wilkinsona

@ddebree No need for a sample now. It looks like the test is faulty as I've reproduced this outside of the test suite.