v2.1: 'Copy' Not Working as Documented

I need to copy a generated EAR to Wildfly’s deployment directory, but I can’t get the Copy task to work.

According to the gradle docs here and here, all I need to do is (for example): ‘’’ task copyTask(type: Copy) {

from ‘src/main/webapp’

into ‘build/explodedWar’ } ‘’’

However executing ‘gradle copyTask’ with Gradle v2.1, I get this error:

Cannot create task of type ‘Copy’ as it does not implement the Task interface.

Please advise.

Check to ensure your IDE isn’t “helping” you by adding an import statement to your ‘build.gradle’ file for some other class called ‘Copy’. I’ve had this happen before in IntelliJ as there is a class with that name bundled with the JDK.