repo.maven.apache.org 的 Nexus 代理不工作
Nexus proxy for repo.maven.apache.org not working
我在 nexus 中为 apache 库创建了一个新闻代理 maven 2:
然后我将 pom.xml 更改如下:
<repositories>
<repository>
<id>maven-public</id>
<url>http://nexus.unc.nc/repository/maven-public/</url>
</repository>
<repository>
<id>maven-releases</id>
<url>http://nexus.unc.nc/repository/maven-releases/</url>
</repository>
<repository>
<id>maven-apache</id>
<url>http://nexus.unc.nc/repository/maven-apache/</url>
</repository>
</repositories>
但它仍然从互联网下载 apache 库:
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ importparcoursup ---
Downloading from central: https://repo.maven.apache.org/maven2/junit/junit/3.8.1/junit-3.8.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/junit/junit/3.8.1/junit-3.8.1.pom (998 B at 2.0 kB/s)
而其他库是从 nexus 获取的:
Downloading from maven-public: http://nexus.unc.nc/repository/maven-public/org/springframework/boot/spring-boot-starter-mail/2.0.6.RELEASE/spring-boot-starter-mail-2.0.6.RELEASE.pom
有人可以帮我吗?
那是因为 central
存储库的配置继承自 super POM。您可以尝试如下覆盖它:
<repository>
<id>central</id>
<url>http://nexus.unc.nc/repository/maven-apache/</url>
</repository>
或者 - 这是一个推荐的解决方案 - 在 settings.xml
中放置一个 mirror definition:
<settings>
...
<mirrors>
<mirror>
<id>company-central</id>
<name>Company Central</name>
<url>http://nexus.unc.nc/repository/maven-apache/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
...
</settings>
我在 nexus 中为 apache 库创建了一个新闻代理 maven 2:
然后我将 pom.xml 更改如下:
<repositories>
<repository>
<id>maven-public</id>
<url>http://nexus.unc.nc/repository/maven-public/</url>
</repository>
<repository>
<id>maven-releases</id>
<url>http://nexus.unc.nc/repository/maven-releases/</url>
</repository>
<repository>
<id>maven-apache</id>
<url>http://nexus.unc.nc/repository/maven-apache/</url>
</repository>
</repositories>
但它仍然从互联网下载 apache 库:
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ importparcoursup ---
Downloading from central: https://repo.maven.apache.org/maven2/junit/junit/3.8.1/junit-3.8.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/junit/junit/3.8.1/junit-3.8.1.pom (998 B at 2.0 kB/s)
而其他库是从 nexus 获取的:
Downloading from maven-public: http://nexus.unc.nc/repository/maven-public/org/springframework/boot/spring-boot-starter-mail/2.0.6.RELEASE/spring-boot-starter-mail-2.0.6.RELEASE.pom
有人可以帮我吗?
那是因为 central
存储库的配置继承自 super POM。您可以尝试如下覆盖它:
<repository>
<id>central</id>
<url>http://nexus.unc.nc/repository/maven-apache/</url>
</repository>
或者 - 这是一个推荐的解决方案 - 在 settings.xml
中放置一个 mirror definition:
<settings>
...
<mirrors>
<mirror>
<id>company-central</id>
<name>Company Central</name>
<url>http://nexus.unc.nc/repository/maven-apache/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
...
</settings>