Create copy task inside model{} block


(Steve) #1

I am new to gradle and trying to create a copy task within the new model block. Is this possible and what would the correct syntax be?

build.gradle
model {
task xyz{} //does not work
task ‘xyz’(type:Copy){} //does not work
}

It produces the following error
Rule must follow the pattern ‘«name»(«type») {}’ for a creator, and ‘«name» {}’ for an action


(Mark Vieira) #2

Looks like this:

model {
    tasks {
        myCopyTask(Copy) {
            from 'foo'
            into 'bar'
        }
    }
}

(Steve) #3

Thanks Mark!

Learning the syntax takes a little time but with help from you guys it will be much easier


(Mark Vieira) #5

Can you share your build script?