Display name
Display name

Reputation: 2747

Gradle force copy task to be executed

I have the following task to copy a file:

task copyFiles(type: Copy) {
    def folder = rootProject.file('/a/b/c')
    println folder.absolutePath
    println folder.exists()
    from(folder) {
        include '*.*'
    }
    into(rootProject.file('/c/b'))
}

I am trying to execute this task as a standalone copy task, so without any binding to the compiling of the project etc.

The problem is that the task is never executed (NO-SOURCE) despite the folder existing:

    C:\...\a\b\b
true
:projectName:copyFiles NO-SOURCE

Upvotes: 1

Views: 747

Answers (1)

Patrik Schalin
Patrik Schalin

Reputation: 86

NO-SOURCE means that the copy task did not find any files to copy based on your configuration.

If /a/b/c are directories as sub-directories in relation to your build.gradle project file then this should work provided that the /c folder contains any files that follow the *.* pattern for names.

https://docs.gradle.org/current/dsl/org.gradle.api.tasks.Copy.html

Upvotes: 2

Related Questions