Calling any task automatically calls all child project tasks with that same name. This is what allows the use of something like ‘gradle build’ to build your entire project and all subproject without defining any explicit dependencies. If you do not want this behavior you’ll have to rename one of the tasks so that their names are unique. Additionally, a child should not typically depend on its parent. Perhaps you could provide some more detail on your use case?
I would probably either create a subproject under A called ‘common’ or something similar and have the example projects depend on it (siblings depending on each other is typically fine). Alternatively, create a Project B with the examples in it, and have B depend on A. In general you just simply want to avoid a structure which would require a child to depend on a parent because that typically introduces a cyclic dependency, as you have observed.
Then, regarding your first solution. Your ‘common’ is my ‘examples’ right? So, if I have examples:example1:dist that depends on dist. I could have a examples:dist that depends on dist, and it would fix the problem? did I understand you?
Wow, I do not quite like that, beside that it adds more complications in my infrastructure (I have simplified things a lot in this post)… I think I will just take this project out and call it “A_Examples” or something similar. Thanks a lot.