A subtle but dangerous Gradle bug involving collection properties and empty providers is explained. When an absent/empty provider is added to a ListProperty without using orElse(), it silently clears the entire collection value rather than just adding nothing — causing MissingValueException or silently destroying conventions. The fix is to always chain orElse() when adding providers to collection properties. This behavior was partially addressed in Gradle 8.7's release notes under 'Better API for updating collection properties'.

1m read timeFrom zacsweers.dev
Post cover image
26 Impressions