How to integrate duplicate handling strategy in application plugin

Shouldn't that be with regular parenthesis?

tasks.withType(Tar) {
   duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

or:

tasks.withType(Tar.class).configureEach {
    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}