title: How does one configure custom maven dependency in `gradle.build.kts` while using `dependencyResolutionManagement` in `settings.gradle.kts`?
body: <p>Gradle fails to resolve dependencies when declaring custom maven repo. It looks for dependencies in the custom repo instead of maven central.</p>
  <p>What I have so far:</p>
  <pre><code>// build.gradle.kts
  repositories {
      maven {
          url = uri(&quot;https://maven.pkg.jetbrains.space/myTeam/p/myProject/maven&quot;)
          credentials {
              username = project.extra[&quot;space_usr&quot;].toString()
              password = project.extra[&quot;space_pwd&quot;].toString()
          }
      }
  }
  // settings.gradle.kts
  dependencyResolutionManagement {
      repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
      repositories {
          google()
          mavenCentral()
      }
  }
  </code></pre>
  <p>But I get the following error : <code>Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'app/build.gradle.kts' </code>.</p>
  <p>If I remvove <code>repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)</code> then I get the following error :</p>
  <pre><code>Could not determine the dependencies of task ':app:kaptDebugKotlin'.
  &gt; Could not resolve all dependencies for configuration ':app:kotlinKaptWorkerDependencies'.
    The project declares repositories, effectively ignoring the repositories you have declared in the settings.
    You can figure out how project repositories are declared by configuring your build to fail on project repositories.
    See https://docs.gradle.org/7.0-rc-1/userguide/declaring_repositories.html#sub:fail_build_on_project_repositories for details.
     &gt; Could not find org.jetbrains.kotlin:kotlin-annotation-processing-gradle:1.4.32.
       Searched in the following locations:
         - https://maven.pkg.jetbrains.space/...
         - https://maven.pkg.jetbrains.space/...
       Required by:
           project :app
  </code></pre>
  <p>I could add my custom maven dependency in  settings.gradle.kts but project.extra is not accessible and requires clear text (edited)</p>