I fairly new to gradle and I got this question that I wasn’t able to find an answer.
My main build.gradle contains a subprojects block with general repositories block.
Something like:
subprojects {
repositories {
mavenCentral()
}
}
One of my subproject requires another repository for one of its dependencies.
I tried adding a repositories block in its build.gradle like:
repositories {
maven {
url 'https://somemavenrepo.com'
}
}
dependencies {
//... dependency that requires the additional repository
}
But the build fail and the logs tell me that gradle seems to ignore the url since it doesn’t try it…
Is it expected? Is there a way to make this work?
For information, I use gradle 4.
Keep in mind that repositories are only used in the project they are declared in. My best guess is that you are transitively leaking a dependency from that repo into another subproject which doesn’t have that repository. Your build then fails for that other project, because it will (by design) only look in its own repos.
@st_oehme that would make sense since other projects depend on this one.
We used to use maven so that dependency might have been leaked transitively yes.
I will double check that and get back to you.