There is nothing to mitigate. If both would end up in the class path anyway only the classes from the first on the class path are used, except if there are unique classes in the second. If you would want to use both separately, you anyway need a more sophisticated runtime model with custom class loaders and so on. And in that case you would also work out a matching Gradle build structure where both end up where they are needed.