First of all, this should only be used in very special cases. Including dependencies in your mod transitively means that you always have to check whether there are any unwanted dependencies down the line, and exclude these.
Note: if you use languages other than Java, e.g. Kotlin, the likelyhood that you need transitive includes increases
First, create a custom configuration. This is also where you specifiy the excludes.