Wessel van Norel
07/08/2025, 7:16 PMgit bisect
to the rescue. But now I've figured out the "offending commit": https://github.com/gradle/gradle/commit/deefa5287670c26fd046ea19250904829063682c, I'm still having problems figuring out why gradle doesn't want to generate the file after first getting it properly from the cache...
First run is with --rerun-tasks
to make sure it's not getting stuff from the cache. And then the first attempt it works, second attempt it doesn't.
--edit
Now the question is: how do I continue from here? I've tried to attach the debugger to the daemon, and the file is reported as a MissingFileSnapshot in both runs. So the difference is also not there. But I'm struggling to figure out where to go next. Should I just open a bug report? But seeing 3000 open issues, I would like to be a bit more helpful.
❯ ./gradlew clean assemble --rerun-tasks --console=plain && ls my-module/build/resources/main/git.properties
Starting a Gradle Daemon, 6 stopped Daemons could not be reused, use --status for details
> Task :my-module:clean
> Task :my-module:compileJava NO-SOURCE
> Task :my-module:generateGitProperties
> Task :my-module:processResources
> Task :my-module:classes
> Task :my-module:jar
> Task :my-module:assemble
BUILD SUCCESSFUL in 2s
4 actionable tasks: 4 executed
my-module/build/resources/main/git.properties
❯ ./gradlew clean assemble --console=plain && ls my-module/build/resources/main/git.properties
> Task :my-module:clean
> Task :my-module:compileJava NO-SOURCE
> Task :my-module:generateGitProperties FROM-CACHE
> Task :my-module:processResources
> Task :my-module:classes
> Task :my-module:jar
> Task :my-module:assemble
BUILD SUCCESSFUL in 352ms
4 actionable tasks: 3 executed, 1 from cache
my-module/build/resources/main/git.properties
❯ ./gradlew clean assemble --console=plain && ls my-module/build/resources/main/git.properties
> Task :my-module:clean
> Task :my-module:compileJava NO-SOURCE
> Task :my-module:generateGitProperties FROM-CACHE
> Task :my-module:processResources
> Task :my-module:classes
> Task :my-module:jar
> Task :my-module:assemble
BUILD SUCCESSFUL in 330ms
4 actionable tasks: 3 executed, 1 from cache
ls: my-module/build/resources/main/git.properties: No such file or directory
Wessel van Norel
07/08/2025, 9:48 PMephemient
07/08/2025, 11:55 PMephemient
07/08/2025, 11:57 PMsourceSets {
main {
resources.srcDir(tasks.named("generateGitProperties").map { layout.buildDirectory.dir("resources/main").get() })
}
}
?Wessel van Norel
07/09/2025, 7:38 AMExecution failed for task ':processResources'.
> Entry test.txt is a duplicate but no duplicate handling strategy has been set. Please refer to <https://docs.gradle.org/8.14.3/dsl/org.gradle.api.tasks.Copy.html#org.gradle.api.tasks.Copy:duplicatesStrategy> for details.
ephemient
07/09/2025, 8:23 AMgitPropertiesResourceDir
? try without, so that it avoids that bit of logic in the pluginVampire
07/09/2025, 9:12 AMgenerateGitProperties
is build/resources/main/git.properties
and the output of processResources
is build/resources/main
.
This is overlapping outputs and that is always prone to breaking stuff.
It just happens to sometimes work because of several other bad practices that plugin is doing like making the classes
task depend on generateGitProperties
and registering build/resources/main
as resources srcDir of the main
source set which means the processResources
task is also self-copying that directory and so on besides quite some other bad practices.
In that state I would very highly recommend not applying that plugin ever to any build.
To avoid the most-problematic non-sense of that plugin, you need to make sure
gitPropertiesResourceDir
is not set as @ephemient said,
additionally set gitPropertiesDir = layout.buildDirectory.dir("generated/resources/git")
to break the overlapping task outputs and add sourceSets { main { resources.srcDir(tasks.generateGitProperties.map { it.output.map { it.asFile.parentFile } }) } }
to properly declare the task output as resource source including the necessary implicit task dependency.
With that the various bugs of the plugin should be avoided / worked-around.Vampire
07/09/2025, 9:15 AMprocessResources
task is never runWessel van Norel
07/09/2025, 12:53 PMare you settingWe are not setting it in the reproducer. But I'll try the solution provided in the ticket. Thanks for helping me here!? try without, so that it avoids that bit of logic in the plugingitPropertiesResourceDir
In that state I would very highly recommend not applying that plugin ever to any build.I'll forward this advice.
Vampire
07/09/2025, 12:57 PMVampire
07/09/2025, 12:58 PMVampire
07/09/2025, 12:58 PMWessel van Norel
07/09/2025, 3:48 PMgit bisect
to actually determine the cause of a bug. Guess better luck next time.Wessel van Norel
07/09/2025, 3:49 PM