I really like the idea to move all repository decl...
# dependency-management
t
I really like the idea to move all repository declaration to one file (settings.gradle.kts) via
dependencyResolutionManagement { repositories {
. But one of my plugin declaring own repository and for some reason Gradle not allow to use repository from both settings and project, why? Why I must choose just one variant? I would welcome
Copy code
repositoriesMode.set(RepositoriesMode.ALLOW_BOTH)
t
How would you order them? settings first? project first? (in all honesty, I would find it OK if the project repository could somehow declared to be exclusive to a given configuration or set of configurations: all other repositories are marked
notForConfigurations
, and that one
onlyForConfigurations
) But there's general agreement that plugins shouldn't declare repositories, and rather let that to plugin users as a prerequisite.
☝️ 1
t
So two mor values 😉 Generally I agree that plugins should no add repositories, especially not public plugins. But in our company we have several separated build environments with own maven mirrors. And apps should be buildable in both so we have own internal only Gradle plugin which do all necessary setup to eliminate as much repeating setup in projects as possible. Gradle is the best building tools for it's flexibility. So this plugin setup also commonly used repositories.
e
you could make that plugin a settings plugin which configures settings.dependencyResolutionManagement.repositories instead of each project's repositories
💯 1
t
Hmm. I even don't know that it is possible to write settings plugin. But it is true, that
Copy code
plugins {
    id("com.gradle.enterprise").version("3.15.1")
}
is possible to apply in settings.