Allow sourceSets with duplicate files

Hi! Im trying to add a second sourceSet if a certain dev condition is met, which should overwrite some files.
Im getting this:
“XX is a duplicate but no duplicate handling strategy has been set.”
The link is sadly of no help, since im not sure where to set the DuplicateStrategy for the sourceSet.
Ive tried running this in a normal “fun” function (kotlin) and in a copy task, both failed.
This is how im adding the dev sourceSet:

sourceSets.getByName("main") {

Id be very thankful for any help here