How to allow several versions of the same dependency?

As I am using OSGi, I wanted to make Gradle allow several different versions of the same dependency in the classpath. I’ve been copying the dependencies using this code:

project.copy {

from project.configurations.osgiRuntime

into bundlesDir }

But this will use Gradle’s resolution mechanism to choose only one version of each group:artifactName combination, which is not what I want!

How can I get around Gradle’s resolution so that I can copy ALL dependencies, without resolving version conflicts?

I figured it out… a little hacky, but what I did was to turn each dependency from my configuration (‘osgiRuntime’) into an indexed configuration with only one dependency (‘osgiRuntime0’, ‘osgiRuntime1’ …). This way, I get every single dependency without resolving version conflicts…

As a result, I actually got a few more jars than I was hoping for, but that’s another story!