Include transitive dependencies only

I want to load jar from local file but i need all transitive dependencies of library excluding library itself.
Gradle doesn’t download transitive dependencies for local jar file.

Hypothetically, what I want is something approximately like:

implementation(group: 'com.x', name: 'Xlib', version: '1.0', ...){
    transitive true                         //include 'A', 'B', and 'C'
    exclude group: 'com.x', module: 'Xlib'  //exclude 'X'
}

Can i make gradle download transitive dependencies from local jar?

How should Gradle know the transitive dependencies of a local jar?
The transitive dependencies are listed in the according metadata file in the repository (ivy.xml file, pom file, Gradle module metadata file).
Without the metadata file it does not know what the transitive dependencies would be and cannot guess them.