Gradle Copy task says no source

Your error is, that the Copy task has a property called source.
You give the toString() representation of this property (which is file tree) to the from method.
There of course no WAR files are found and thus the copy task has nothing to do.
Either rename your source property to something different, or use project.source to explicitly reference the source property of the project instead of the one from the task.

Besides that into "${target}" is identical to into target but is more performant. source and target are already strings, but you use them as placeholders which means the placeholder needs to be evaluated first which doesn't make too much sense.


Consider this gradle.properties:

srcDir=./dist
targetDir=./target

You can replace dist and target with your desired folders. Using srcDir means that we won't collide with properties of the Copy task.

Then, this build.gradle:

task copyWar(type: Copy) {
    from srcDir
    into targetDir
    include '*.war'
}

should work (it does for me).


Check very carefully that you do not have directory or file names misspelled. Gradle doesn't tell you what it didn't recognize, it just says

Task :xxx NO-SOURCE

Tags:

Gradle