How to replace a gradle dependency with a jar?

My project has a dependency -

How to replace it with libs/gson-2.8.5.jar

I have already used this method

 implementation files('libs/gson-2.8.5.jar')

configurations.all {
     exclude group: '', module: 'gson'

This works, but I need to make a replacement using these

dependencies {
modules {
    module("") {
        replacedBy("", "google-collections is now part of Guava")


includeBuild('anonymous-library') {
dependencySubstitution {
    substitute module('org.sample:number-utils') with project(':')


Is it possible?