Gradle ignoring maven local and going to remote for fetching compile dependencies(gradle 4.7)

repositories {
mavenLocal()

maven {
    url uri(BUILD_PATH_TO_LOCAL_M2_REPO)
}

maven {
    url uri(BUILD_PATH_TO_LOCAL_ARTIFACTORY)
}

url ‘http://remote-url

}

dependencies {
compile (group: ‘com.xxx.xxx’, name: xxx_SERVICE_NAME, version: XXX_VERSION) {
transitive = false
}
compile group: ‘com.cisco.apicem’, name: xxx_SERVICE_NAME, version: xxx_VERSION, classifier: ‘package’, ext: ‘tar.gz’
}

This is some code from my build.gradle. the dependencies are not defined in remote and it for sure in local artifactory and local m2…but gradle sometime goes to remote to fetch and fails because we dont have these dependencies remotely. Why it is ignoring the local repositories?

The logs:

9:36:16.020 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.modulecache.ResolvedArtifactCaches] Reusing in-memory cache for repo ‘maven’ [6809d7639eca3e535f3b40ad38dacd58].
19:36:16.020 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.modulecache.ResolvedArtifactCaches] Reusing in-memory cache for repo ‘MavenLocal’ [c84afe059f4223144c5a08d7bb13de0f].
19:36:16.021 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.modulecache.ResolvedArtifactCaches] Creating new in-memory cache for repo ‘maven2’ [084b4bd3eea6576c122db0abf794b262].
19:36:16.022 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.modulecache.ResolvedArtifactCaches] Creating new in-memory cache for repo ‘maven3’ [6834339df3578ea60dcb05522674b21d].
19:36:16.023 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.DependencyGraphBuilder] Visiting configuration :cnsr-reasoner:unspecified(compile).
19:36:16.026 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.DependencyGraphBuilder] Selecting new module com.xxx.cnsr:cnsr-reasoner-service
19:36:16.026 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.DependencyGraphBuilder] Selecting new module com.xxxx.cnsr.kb:cnsr-kb
19:36:16.026 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.DependencyGraphBuilder] Submitting 4 metadata files to resolve in parallel for :cnsr-reasoner:unspecified(compile)
19:36:16.026 [DEBUG] [org.gradle.internal.work.DefaultWorkerLeaseService] Worker lease root.1.56.57 started (1 worker(s) in use).
19:36:16.026 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Daemon worker: acquired lock on root.1.56.57
19:36:16.026 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation ‘Resolve com.xxx.cnsr:cnsr-reasoner-service:7.28.40.9001544’ started
19:36:16.026 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver] Attempting to resolve component for com.xxx.cnsr:cnsr-reasoner-service:7.28.40.9001544 using repositories [maven, MavenLocal, maven2, maven3]
19:36:16.027 [DEBUG] [org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceArtifactResolver] Loading http://engci-maven-master.xxxx.com/artifactory/Tesseract-group/com/xxxx/cnsr/cnsr-reasoner-service/7.28.40.9001544/cnsr-reasoner-service-7.28.40.9001544.pom
19:36:16.027 [DEBUG] [org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor] Constructing external resource: