Is it possible to have multiple repos in a resolve

2020-07-07 11:45发布

问题:

I have not been able to resolve against two repositories (ext-releases-local and repo1-cache) on one Artifactory server. My build seems to only resolve against the last repository in the list and ignore the first one. Basically, I have my project's dependencies in ext-releases-local, and their transitive dependencies can be found in the remote repository called repo1-cache. So I need to resolve against both using the Artifactory Gradle plugin. Here is the setup that I have tried in my build.gradle:

artifactory {
  contextUrl = "https://myartifactory.host.com"
  publish {
    repository {
      repoKey = "myproj-releases-local"
      username = "${artifactory_deployer_user}"
      password = "${artifactory_deployer_password}"
    }
  }
  resolve {
    repository {
      repoKey = "repo1-cache"
      username = "${artifactory_reader_user}"
      password = "${artifactory_reader_password}"
    }
    repository {
      repoKey = "ext-releases-local"
      username = "${artifactory_reader_user}"
      password = "${artifactory_reader_password}"
    }
  }
}

I would appreciate any help/advice on getting this to work. There isn't any documentation out on jfrog's website to tell whether resolving to two repos is supported or not. It's definitely possible to do it without the Artifactory Gradle plugin, but unfortunately I will be building via Bamboo, and the Artifactory Gradle plugin has become necessary for release management.

回答1:

From what I can tell, this isn't supported. However, you can always create a virtual repository on the Artifactory side that includes ext-releases-local and repo1-cache. (There is also a predefined virtual repository named /repo that includes all repositories.) As a nice side effect, this will likely perform better than declaring two repositories on the Gradle side.