I have the following setup in my build.gradle file:
repositories {
maven {
url = ‘https://somewebsite…/maven-prod/’
credentials {
username = “…”
password = “…”
}
}
}
However when Gradle cannot find a particular artifact maven-prod repo above it then searches in the following repo: https://somewebsite…/maven-dev/
I don’t explicitly set this anywhere. Is this something that’s controlled in Gradle? How can I disable it? I only want maven-prod to be checked and not maven-dev.
Chris, additional question: is it possible to configure build.gradle file to enforce that only prod repo is checked? I’m afraid that even if this particular plugin is fixed then some other plugin can introduce a similar problem.
If your intent is that you want specific modules to only be resolved from a specific repository, then using “exclusive content filtering” might be want you need.
You can also add include/exclude filters per repository.
Another way would be to define the repository in the settings script in the dependencyResolutionManagement block and also set repositoriesMode.set(FAIL_ON_PROJECT_REPOS), then the build will fail if someone or something tries to add a different repo.
What I was thinking is something like: remove all repositories added by plugins and add all of the repositories that I want to use. Do you have an example for how to do this?
That would functionally be the same as declaring your repos in the settings script and using repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS). That way you only get a warning instead of a failure.
@Vampire I was unaware of this feature, thanks for pointing it out.
You are right, this was added in 6.8.
Is there anything preventing you to upgrade Gradle?
6.6.1 → 6.8 should hopefully be a pretty easy upgrade without problems.