I have two github pacakges named XXX/AAA and YYY/BBB (same OWNER but different repository).
Now, when I try to add them into my project, gradle always seem to use the 1st repository.
repositories {
maven { url 'https://jitpack.io' }
maven {
url "https://maven.pkg.github.com/XXX/AAA"
credentials {
username = USERNAME
password = PWD
}
}
maven {
url "https://maven.pkg.github.com/XXX/BBB"
credentials {
username = USERNAME
password = PWD
}
}}
And com.example in implementation is also same.
dependencies {
// implementation 'com.example:package'
// AAA
implementation("YYY:AAA:${a_version}")
// BBB
implementation("YYY:BBB:${b_version}")
}
and I receive the following error while syncing
Could not HEAD 'https://maven.pkg.github.com/XXX/AAA/YYY/BBB/0.1/BBB-0.1.pom'. Received status code 400 from server: Bad Request. Disable Gradle 'offline mode' and sync project
As we can clearly see, gradle uses the wrong repository(AAA instead of BBB)
Any help is appreciated.
Thanks in advance
You need to declare these repositories as exclusive for the respectful dependencies: