You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make it possible for the output from the BuildInfo task to be repeatable #14494
Thanks for the report. Nulling out the time is aimed at up-to-date checking rather than repeatability. It works fine for up-to-date checks as Gradle compares the property key-value pairs and doesn't care about any comments. Unfortunately, the writing of the date is baked into java.util.Properties and can't be disabled. Short of implementing our own class for writing the properties to disk, or using a custom Writer that suppresses the output of the comment, there's not a lot we can do about this.
changed the title [-]build-info.properties contains timestamp in header comment[/-][+]build-info.properties isn't repeatable due to a timestamp that is included in a comment[/+]on Sep 17, 2018
Thanks for the pointer to WriteProperties. I wasn't aware of that Gradle task. Unfortunately, the code in question here is shared between our Gradle plugin and our Maven plugin so changing it to depend on something that's Gradle-specific isn't an option. It does, however, open up the option of reworking things to no longer use the shared code and use WriteProperties in the Gradle case. We've done something similar in other places in the plugin where the shared code didn't work well with Gradle.
changed the title [-]build-info.properties isn't repeatable due to a timestamp that is included in a comment[/-][+]Make it possible for the output from the BuildInfo task to be repeatable[/+]on Sep 19, 2018
In my projects using the gradle plugin v2.0.6.RELEASE, the bootBuildInfo task always fails the up-to-date check. This has the adverse effect of always triggering the test task which fires off unit tests.
springBoot {
buildInfo()
}
When following the workaround @pgilad suggested, the up-to-date checks work correctly, and the test task is not always run.
The default value for build.time is the instant at which the project is being built. A side-effect of this is that the task will never be up-to-date. As a result, builds will take longer as more tasks, including the project’s tests, will have to be executed. Another side-effect is that the task’s output will always change and, therefore, the build will not be truly repeatable. If you value build performance or repeatability more highly than the accuracy of the build.time property, set time to null or a fixed value.
Activity
wilkinsona commentedon Sep 17, 2018
Thanks for the report. Nulling out the time is aimed at up-to-date checking rather than repeatability. It works fine for up-to-date checks as Gradle compares the property key-value pairs and doesn't care about any comments. Unfortunately, the writing of the date is baked into
java.util.Propertiesand can't be disabled. Short of implementing our own class for writing the properties to disk, or using a customWriterthat suppresses the output of the comment, there's not a lot we can do about this.[-]build-info.properties contains timestamp in header comment[/-][+]build-info.properties isn't repeatable due to a timestamp that is included in a comment[/+]sdavids commentedon Sep 17, 2018
Also, the order of the keys could be sorted to be independent of their hash values.
sdavids commentedon Sep 17, 2018
https://docs.gradle.org/current/dsl/org.gradle.api.tasks.WriteProperties.html
wilkinsona commentedon Sep 18, 2018
Thanks for the pointer to
WriteProperties. I wasn't aware of that Gradle task. Unfortunately, the code in question here is shared between our Gradle plugin and our Maven plugin so changing it to depend on something that's Gradle-specific isn't an option. It does, however, open up the option of reworking things to no longer use the shared code and useWritePropertiesin the Gradle case. We've done something similar in other places in the plugin where the shared code didn't work well with Gradle.[-]build-info.properties isn't repeatable due to a timestamp that is included in a comment[/-][+]Make it possible for the output from the BuildInfo task to be repeatable[/+]pgilad commentedon Dec 15, 2018
This is what I do in the meantime:
springBoot { mainClassName = 'com.sample.sample.SampleApplication' buildInfo { properties { time = null } // Watch https://github.com/spring-projects/spring-boot/issues/14494 doLast { File f = new File(destinationDir, 'build-info.properties') f.text = f.filterLine { !it.startsWith('#') } } } }And I get the same md5 for each jar
merusso commentedon Dec 19, 2018
In my projects using the gradle plugin v2.0.6.RELEASE, the
bootBuildInfotask always fails the up-to-date check. This has the adverse effect of always triggering thetesttask which fires off unit tests.When following the workaround @pgilad suggested, the up-to-date checks work correctly, and the
testtask is not always run.wilkinsona commentedon Dec 19, 2018
@merusso This is already discussed above and noted in the documentation that's linked to in the description of the issue:
wilkinsona commentedon May 28, 2019
With thanks to @sbrannen for the new sorted properties support in Framework, this one is now straightforward.
mbarve31 commentedon Dec 5, 2019
How to make multiple properties null?
philwebb commentedon Dec 5, 2019
@mbarve31 Please ask questions on stackoverflow.com or join us on gitter.im. We prefer to keep the issue tracker for bugs and enhancements.