Can you help me with this problem please? I have to use in-house built-in dependencies which is hosted on Nexus
for Netflix conductor
project. I have setup the settings.xml
which resolves the repository URL for Nexus
repository.
I couldn't understand how the gradle will resolve these dependencies, currently my gradle is not searching for the in-house dependencies hosted on Nexus
.
What I am missing so that I can use our nexus repository as well as also using the Netflix provided repository?
These are the repositories settings in build.gradle file.
repositories {
mavenCentral()
// oss-candidate for -rc.* verions:
maven {
url "https://artifactory-oss.prod.netflix.net/artifactory/maven-oss-candidates"
}
/**
* This repository locates artifacts that don't exist in maven central but we had to backup from jcenter
* The exclusiveContent
*/
exclusiveContent {
forRepository {
maven {
url "https://artifactory-oss.prod.netflix.net/artifactory/required-jcenter-modules-backup"
}
}
filter {
includeGroupByRegex "com\\.github\\.vmg.*"
}
}
}
I tried adding the following after the maven
block but it didn't work.
maven {
name "server-id"
url "https://repo.******.com/repository/***"
}
Your response is appreciated.
Thank you!
CodePudding user response:
You can use multiple repositories by configuring them in both the settings.xml file and the build.gradle file.
In the settings.xml file, you can specify the repositories that should be used for all projects that use the same settings.xml file. For example, you can add a section to the settings.xml file and specify the URLs of the repositories that should be used.
In the build.gradle file, you can specify the repositories that should be used for the specific project. You can do this by adding the following in the build.gradle file:
repositories {
maven {
url 'http://my.custom.repo/maven2'
}
mavenLocal()
mavenCentral()
}
n this example, the first repository is a custom repository, the second is the local repository, and the third is the central repository.
You can also define the repositories in the build.gradle file using the repositories block, this will override any repository defined in the settings.xml
It's important to notice that repositories that are defined in the build.gradle file will have higher priority than those defined in the settings.xml file.
You can also use both repositories together by specifying them in both the settings.xml file and the build.gradle file, in this case the build.gradle file will have higher priority and will be used first to resolve dependencies.