Find class in a dependency before JDK

Hi everyone.

I’m quite new with gradle and I encounter the following issue. The project is about software analysis so this may is a bit odd.

I have modified class and others and added to my project as .class libraries. Using gradle my settings are:

dependencies {
 	compile files("socket_lib") // socket_lib contains the modified .class files 

socket_lib -> java -> net -> *.class

The issue arises becuase classes are first find in JDK by default . I need to use those in socket_lib.

The issue can be manually fixed moving the priority of the dependencies, creating a IntelliJ project from gradle files.

The left is how the project is generated from gradle and the right is how the issue is manually fixed.

How can I replicate the Intellij dependency ordering in gradle?

Thanks in advance.