How to add a task of a certain type in a custom plugin?

I am currently trying to move all the custom stuff that I normally import via

apply from: System.getenv()['GRADLE_HOME'] + '/config/gradle_std_include.gradle'

to a custom plugin which would basically do the same but much nicer.

Adding regular tasks of no specific type is easy:

private def addDeployTask(Project project) {
     project.task('deploy') << {
            def warTask = project.tasks.getByName('war')
            dependsOn warTask
            def tomcatDirName = project.getProperty('tomcat.deploy')
            println "Deploy folder is " + tomcatDirName
            tomcatDir = project.file(tomcatDirName)
            project.copy {
                from(warTask.archivePath)
                into(tomcatDir)
            }
            println "Copied $warTask.archivePath to $tomcatDir"
     }
}

But how would i make the added task of type “Copy” ? I can imagine this might be basic and trivial. But I spent already like half an hour on that - maybe it saves me some time when asking you guys…

Ok, it WAS indeed trivial. Found it here in the forums…:

project.task([type: Copy],'deploy') << {