Ant to Gradle migration

Hi,
Our project was built on ant. Now we are planning to migrate to gradle.
OS : WIndows server 2012.
gradle version : 5.6.1.

The issue is, when i run gradle build , it is successful without the jars required for tests.
After incorporating test jars, the build fails at testCompileJava task.
All the custom jars are deployed in our internal repository.
I always get the error as below:
java.lang.StackOverflowError
at org.gradle.cache.internal.btree.CachingBlockStore.read(CachingBlockStore.java:92)

at org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceArtifactResolver.downloadByCoord

Need help in resolving this. Also would like to understand more on:
i) Best practices to migrate to gradle from ant.
ii) Are any proxy settings required when we use windows server 2012. I remember setting up proxy for gradle when running through CNTLM on Mac.
iii) When i set JVM args as well i could see issues.

@Anony123 Have you seen https://docs.gradle.org/current/userguide/migrating_from_ant.html ?

No jendrik, will have a look.

No jendrik, will have a look.