How to configure gradle to retrieve all dependencies and plugins from a Nexus Repository

We have a React Native App and we have to download all the dependecies fo my App from the Company Nexus repository.

We have a maven gruop repository with lot of repository inside. One of them is a maven proxy repository that point to: https://plugins.gradle.org/m2/b

We configured our settings.grandle like this:

pluginManagement {
  repositories {
    maven { url 'URL_OF_NEXUS_GROUP_MAVEN_REPO' }
  }
}
dependencyResolutionManagement {
  repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
    repositories {
      maven { url 'URL_OF_NEXUS_GROUP_MAVEN_REPO' }
  }
}

We are able to download all dependecies from our repo but we encounter only a problem during build and compile: one of our dependencies in package.json is react-native-keychain and it has this build.gradle:

buildscript {
  repositories {
    maven {
      url 'https://plugins.gradle.org/m2/'
    }
  }
  dependencies {
    classpath 'com.adarshr:gradle-test-logger-plugin:2.0.0'
  }
}

apply plugin: 'com.android.library'
apply plugin: "com.adarshr.test-logger"

Why this setting is not overwritten like the others by our settings.gradle?

Thank you

@Gianne Were you able to get this working?

I’m encountering a similar issue with Capacitor projects; where a number of auto-generated buildscript files include external repos like google(), and we want to ignore those and use our internal Maven registry.