I have a dependency which exist in two places - one is in GitHub and another one is in internal Maven repository. While doing internal testing, I do testing from the Maven internal repository, and when doing release testing, I should get artifact only from GitHub and exclude the artifact downloading from internal Maven repository. I don't want to comment the Maven internal repository while doing release testing. How can I exclude a dependency downloading from the internal Maven repository.
allprojects {
repositories {
maven {
url "https://github.com.sample.repo.url"
credentials(HttpHeaderCredentials) {
name = "Authorization"
value = "Bearer " + "${findProperty('githubtoken')}"
}
authentication {
header(HttpHeaderAuthentication)
}
}
mavenCentral()
maven {
url "https://anotherurl.com"
credentials {
username "VSTS"
password System.getenv("VSTS_ENV_ACCESS_TOKEN") ?: "${findProperty('vstsGradleAccessToken')}"
}
content {
exclude group: 'somegroupname', module: 'somemodulename'
}
}
}
}