我的依赖项中有一个pom,其中包含:
<repositories>
<repository>
<id>spring-releases</id>
<url>http://repo.spring.io/libs-release-remote/</url>
</repository>
<repository>
<id>public-jboss</id>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss</url>
</repository>
<repository>
<id>spring-plugin-releases</id>
<url>http://repo.spring.io/plugins-release/</url>
</repository>
和$ M2_HOME中的settings.xml包含:
<settings>
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://mynexus/repository/maven-public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>ignore-repositories</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<pluginRepositories>
<pluginRepository>
<id>public-jboss</id>
<url>http://mynexus/repository/maven-public/</url>
</pluginRepository>
<pluginRepository>
<id>spring-releases</id>
<url>http://mynexus/repository/maven-public/</url>
</pluginRepository>
<pluginRepository>
<id>spring-plugin-releases</id>
<url>http://mynexus/repository/maven-public/</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
我还尝试了repositories/repository
:
<settings>
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://mynexus/repository/maven-public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>ignore-repositories</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>public-jboss</id>
<url>http://mynexus/repository/maven-public/</url>
</repository>
<repository>
<id>spring-releases</id>
<url>http://mynexus/repository/maven-public/</url>
</repository>
<repository>
<id>spring-plugin-releases</id>
<url>http://mynexus/repository/maven-public/</url>
</repository>
</repositories>
</profile>
</profiles>
</settings>
但是,当maven解决这个pom示例时,永远不会接受mynexus:
[INFO] --- wildfly-swarm-plugin:2016.10.0:package (package) @ microservice-attendee ---
Downloading: http://mynexus/repository/maven-public/org/wildfly/swarm/fraction-list/2016.10.0/fraction-list-2016.10.0.pom
Downloaded: http://mynexus/repository/maven-public/org/wildfly/swarm/fraction-list/2016.10.0/fraction-list-2016.10.0.pom (2 KB at 16.4 KB/sec)
Downloading: http://mynexus/repository/maven-public/org/wildfly/swarm/tools/2016.10.0/tools-2016.10.0.pom
Downloaded: http://mynexus/repository/maven-public/org/wildfly/swarm/tools/2016.10.0/tools-2016.10.0.pom (2 KB at 215.5 KB/sec)
Downloading: http://mynexus/repository/maven-public/com/eclipsesource/minimal-json/minimal-json/0.9.4/minimal-json-0.9.4.pom
Downloaded: http://mynexus/repository/maven-public/com/eclipsesource/minimal-json/minimal-json/0.9.4/minimal-json-0.9.4.pom (5 KB at 53.2 KB/sec)
Downloading: http://mynexus/repository/maven-public/org/wildfly/swarm/fraction-list/2016.10.0/fraction-list-2016.10.0.jar
Downloading: http://mynexus/repository/maven-public/com/eclipsesource/minimal-json/minimal-json/0.9.4/minimal-json-0.9.4.jar
Downloading: http://mynexus/repository/maven-public/org/wildfly/swarm/tools/2016.10.0/tools-2016.10.0.jar
Downloaded: http://mynexus/repository/maven-public/org/wildfly/swarm/fraction-list/2016.10.0/fraction-list-2016.10.0.jar (171 KB at 12211.5 KB/sec)
Downloaded: http://mynexus/repository/maven-public/com/eclipsesource/minimal-json/minimal-json/0.9.4/minimal-json-0.9.4.jar (30 KB at 1859.1 KB/sec)
Downloaded: http://mynexus/repository/maven-public/org/wildfly/swarm/tools/2016.10.0/tools-2016.10.0.jar (65 KB at 4276.7 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/glassfish/javax.json/1.0.3/javax.json-1.0.3.pom
Downloading: http://mynexus/repository/maven-public/org/glassfish/javax.json/1.0.3/javax.json-1.0.3.pom
Downloaded: http://mynexus/repository/maven-public/org/glassfish/javax.json/1.0.3/javax.json-1.0.3.pom (10 KB at 392.0 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/glassfish/json/1.0.3/json-1.0.3.pom
Downloading: http://mynexus/repository/maven-public/org/glassfish/json/1.0.3/json-1.0.3.pom
...
有什么想法吗?
感谢您的帮助。
mvn --version
Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_91, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: fr_FR, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-45-generic", arch: "amd64", family: "unix"
答案 0 :(得分:2)
而不是忽略repo,您可以在settings.xml配置文件中创建特定的repo,如下所示
<settings>
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://mynexus/repository/maven-public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>specify-repositories</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>spring-releases</id>
<url>http://repo.spring.io/libs-release-remote/</url>
</repository>
<repository>
<id>public-jboss</id>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss</url>
</repository>
<repository>
<id>spring-plugin-releases</id>
<url>http://repo.spring.io/plugins-release/</url>
</repository>
</repositories>
</profile>
</profiles>
</settings>