Conventional way of copying files in Gradle – use Copy task or copy method?

In most cases (including this one), the Copy task is the better choice. Among other things, it will give you automatic up-to-date checking. The copy method is meant for situations where (for some reason) you have to bolt on to an existing task and cannot use a separate task for copying.

The code for your Copy task can be simplified to:

task myCopy(type: Copy) {
    from('source')
    into('target')
    include('*.war')
}

Leave a Comment