Replace dependencies in submodule

In one of my submodules there is a file dependency. This submodule exists as separate git repositroy and I want to keep its build.gradle as it is.

apply plugin: 'java'

dependencies {
    compile files('lib/changedName.jar')
}

But i want to force dependency on another submodule instead of file from my root build.gradle. Is it possible?
The problem is that the name of jar doesn’t match module name.

I need to effectively override submodule dependenices with following:

dependencies {
    compile project(':anotherSubModule')
}

so anotherSubModule should be used instead of changedName.jar