I have this file META-INF\services\org.junit.jupiter.api.extension.Extension in multiple places in source each with respective properties related to that code module
However during the building all these property files needs to be merged and only file with the name org.junit.jupiter.api.extension.Extension should be copied
Is there a merge strategy if no by default, can I extend gradle some way and use it
Sounds like you try to build a bad-practice fat jar.
Such service files are one of the many reasons they are a bad idea.
See https://fatjar.net/ for more quotes about it.
If you really want to build such a mess you should probably use John Engelman’s shadow plugin which mitigates some of the problems these fat jars produce, amongst them merging service descriptor files.
Does fatjar help in mergining same file name properties that exist in different locations?
I assumed you do build a fatjar and because of that have the problem with the same-named files where only one survives.
A fatjar imho does never help for anything but only produce problems.
I would never recommend building a fatjar, except maybe a good-practice one like Spring Boot is doing.
How do I create a custom MERGE duplicate strategy
I don’t think you can. At least I’m not aware of.
Something like that plugin might be what you need then.
If it does not work, I suggest you open a bug report to it.
Again, do not trust any of the non-sense ChatGPT produces.
I already explained that in other threads, also by you.
Also, do never, ever, ever, ever have tasks with overlapping outputs.
With your task you write into the output directory of the processTestResources task and thus have overlapping outputs.
This causes a lot of problems and performance degradation, so never, ever, ever do that.