Copy Task always gets Skipped and is considered Up-To-Date

I have a simple copy task:
task(“rs”) {
When I run this task, I get output as:
Skipping task ‘:rs’ as it has no actions.

1- Why is it always UP-To-Date?
2- Why does it say that it is Skipping task: rs, even though the zip gets copied?
3- Why the incremental build does not work here?

You have created a task called rs that does nothing upon execution (no actions).

You are manually copying the zip whenever the rs task is configured, not when it executes (as it would if the copy was added as a task action). Minimally, the project.copy { ... } should be wrapped in a doLast { } block to add it as task action, not execute it immediately when any build is run.

The above reasons, plus you don’t have inputs and outputs for the task.

If this is really just a simple copy with no special requirements, you’re better off using the Copy task type instead of essentially re-implementing it:

task rs (type: Copy) {
    from 'C:/'
    into buildDir
1 Like