多个存储库的Maven设置

我在settings.xml中有以下内容

  paid-jars jars with license http://url:8081/nexus/content/repositories/paidjars/ !central   Org-central mirror of central http://url:8081/nexus/content/repositories/central/ central   

在pom.xml中我有两个jar子

  1. apache-commons.jar(我假设从中心下载)
  2. licensed.jar(我假设从付费jar子下载)

但是当我运行maven clean install它会尝试从Org-central下载licensed.jar。

如何让它使用付费jar子下载? 是否有可能首先进入Org-central,如果失败,它会尝试付费jar子? 如果是这样,怎么样? 我不想把repo条目放在pom.xml中


将Settings.xml

     Proxy true http username ****** host.url 8080 local.net|internal.com     paid-jars jars with license http://url:8081/nexus/content/repositories/paidjars/ !central   Org-central mirror of central http://url:8081/nexus/content/repositories/central/ central     compiler  C:\Program Files (x86)\Java\jdk1.7.0_51\bin     

你必须设置镜像

  nexus * http://internal/nexus/content/repositories/thirdparty   google google http://google-maven-repository.googlecode.com/svn/repository  

然后添加内部和外部回购

  nexus   central central http://internal/nexus/content/repositories/thirdparty   google google http://google-maven-repository.googlecode.com/svn/repository    

指定专用存储库以查找工件是不可能的。 Maven将逐个查找所有已配置的存储库,直到找到工件。 只需将中心镜像和内部存储库添加到settings.xml

阅读Maven指南以设置多个存储库 。 关于存储库的顺序,请参阅此答案 。

settings.xml ,除了在profile使用相同的内容之外,还为存储库定义了包含idurl mirror ,如下所示:

   Artifactory http://localhost:4900/archiva/repository/ artifactory   MavenCentral https://repo.maven.apache.org/maven2 central     Project  1.0.9 false false false 1.8 1.8    Artifactory Maven Artifactory for Project http://localhost:4900/archiva/repository/ default  true never   true never    MavenCentral https://repo.maven.apache.org/maven2/