我在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 lib:
[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)
而其他lib则来自关联:
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
有人可以在这里帮助我吗?
答案 0 :(得分:4)
这是因为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>