How to specify destinations as files in Copy

My build does a lot of copying files; multiple copy tasks have the same output directory. Other tasks depend on individual files within those shared directories. This leads to warnings about missing dependencies that do not really exist, because those tasks see the output directory, not the individual files (although I tried to specify those as outputs of the copy task as well).

Ideally, I would have the possibility to specify the target files instead of the target directory in the Copy tasks; if required copying one file at a time.

What would be the best approach to get rid of the warnings?

Do not use a task of type Copy, it has the directory as output, full-stop.
And yes, overlapping task outputs is a very bad und undesirable state.
Instead make a task without type or your own custom type and use project.copy { ... } or better copy on a FileSystemOperations instance in its task action, then you can declare the exact inputs and outputs of your task and Gradle will see no more than exactly those.

You can then also properly wire task outputs to where you need the inputs to get the necessary task dependencies automatically without using bad-practice explicit dependsOn declarations.

Yes, I am aware of the shortcomings. Also thought about creating a custom copy task or instead of copying the files jarring them to the destination and unpacking them when used.

Thansk for answering.