Issue copying files with daemon 5.1


I need to deploy a release which uses Gradle daemon 5.1. But when building it, it fails to copy a file from a project´s resource folder to the assembly destination folder. Main issue is, instead of taking the project root path, it takes the daemon path in both: origin and destiny.

I’m using idk 8 trying to keep compatibility with daemon.

Any suggestions?

That build has an error.
It most likely uses the File constructor with a relative path.
Using this constructor is in 99% of the cases wrong in any Java project.
It resolves the relative path relative to the current working directory.

For Gradle builds this sometimes is the root project directory in which case that build works as intended,
but it can also be the IDE installation directory, or the daemon start directory, or any other directory.
Any build that relies on the working directory being the root project directory has a bug and should be fixed.

The build should for example use layout.projectDirectory.dir(...) instead which resolves the relative path relative to the project directory.

The probably only case where File constructor with relative path is appropriate is, if you develop a commandline utility and the relative path is something specified by the user as argument on the tool invocation.