Exclude a Jar file copied manually in subproject to avoid collision

In a Gradle project we have a folder wherein we have a couple of JARs copied manually(its done this way because not all the jars and their dependencies are available in gradle).

Now I am adding a gradle dependency which has a dependency which conflicts with one of the jars from above folder.

I tried the usual exclusion command while including the sub-project as below, but it does not seem to exclude the jar. Is exclusion even supposed to work here?

implementation (project(':module:customJarFolder')) {
    exclude group: 'group', module: 'artifactId'
}

The exclude command above is correct because i tried it with the new dependency i am adding and the troublesome dependency gets excluded(verified from dependency tree)