Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
配置多个Maven存储库_Maven_Intellij Idea_Maven 2_Maven 3_Nexus - Fatal编程技术网

配置多个Maven存储库

配置多个Maven存储库,maven,intellij-idea,maven-2,maven-3,nexus,Maven,Intellij Idea,Maven 2,Maven 3,Nexus,我有一个SpringBoot项目,它使用maven和IntelliJ IDEA Ultimate Edition(一个主要用于Java项目的构建自动化工具) 我为maven提供了这个settings.xml,但是当我执行mvn-U clean安装时,只有第一个存储库才能找到文件 <?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"

我有一个SpringBoot项目,它使用maven和IntelliJ IDEA Ultimate Edition(一个主要用于Java项目的构建自动化工具) 我为maven提供了这个
settings.xml
,但是当我执行
mvn-U clean安装时,只有第一个存储库才能找到文件

<?xml version="1.0" encoding="UTF-8"?>


<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <localRepository>C:/Users/sandro/.m2</localRepository>


  <pluginGroups>
  </pluginGroups>
  <proxies>
  </proxies>
  <servers>
  </servers>
  <mirrors>
    <mirror>
      <id>TeamNexus1</id>
      <mirrorOf>*</mirrorOf>
      <name>TeamNexus1</name>          
      <url>http://benficiones.com:8081/nexus/content/groups/public/</url>          
    </mirror>
    <mirror>
      <id>TeamNexus2</id>
      <mirrorOf>*</mirrorOf>
      <name>TeamNexus2</name>    
      <url>http://benficiones2.com:8081/nexus/content/groups/public/</url>
    </mirror>
  </mirrors>
  <profiles>
  <profile>
     <id>p1</id>
     <repositories>     
        <repository>
              <id>TeamNexus1</id>
            <name>TeamNexus1</name>      
            <url>http://benficiones.com:8081/nexus/content/groups/public/</url>      
            <releases><enabled>true</enabled><updatePolicy>always</updatePolicy></releases>
            <snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots>
        </repository>
        <repository>
            <id>TeamNexus2</id>
            <name>TeamNexus2</name>   
                   <url>http://benficiones2.com:8081/nexus/content/groups/public/</url>
             <releases><enabled>true</enabled><updatePolicy>always</updatePolicy></releases>
             <snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots>
        </repository>
  </repositories>
</profile>
  </profiles>
  <activeProfiles>
   <activeProfile>p1</activeProfile>
 </activeProfiles>
</settings>

C:/Users/sandro/.m2
团队关系1
*
团队关系1
http://benficiones.com:8081/nexus/content/groups/public/          
团队关系2
*
团队关系2
http://benficiones2.com:8081/nexus/content/groups/public/
p1
团队关系1
团队关系1
http://benficiones.com:8081/nexus/content/groups/public/      
永远如此
永远如此
团队关系2
团队关系2
http://benficiones2.com:8081/nexus/content/groups/public/
永远如此
永远如此
p1

您定义了TeamNexus1 als
所有内容。这意味着任何请求,无论它们去了什么存储库,都会被重定向到TeamNexus1

这可能不是你想要的


如果您想在MavenCentral(隐式配置)之外使用这两个存储库,您可以删除整个
部分。

使用建议的解决方案,我有一个错误:无法读取org.jacoco:jacocomaven插件的工件描述符:jar:0.8.0:无法将工件org.jacoco:jacocomaven插件:pom:0.8.0从/传输到中心():连接到repo.maven.apache.org:443[repo.maven.apache.org/151.101.36.215]失败:连接超时:连接然后您可能无法直接连接到MavenCentral。这些工件是否在TeamNexus存储库中?事实上,我认为只有删除第二个镜像,第一个镜像,才能写入
*,!TeamNexus2
前面的评论是最好的方法。如果完全删除镜像部分,那么Maven将开始使用pom文件中的存储库定义,这将导致出现问题。使用“*,!TeamNexus2”。