Maven 不下载包
2021-03-09 本文已影响0人
林万程
查看 Nexus 有包,但是 Linux 服务器上没有下载,也没有下载日志,
在 setting.xml 中添加如下配置,注意 url 换成自己公司的私服仓库
<profile>
<id>down_snapshots</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>central</id>
<name>Nexus</name>
<url>http://ip:port/repository/company_or_app_name/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Nexus</name>
<url>http://ip:port/repository/company_or_app_name/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled> </snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
最近找到了在 pom.xml 中解决的方法:
https://www.cnblogs.com/2005wind/p/4899983.html
还有分析例子:
http://blog.sina.com.cn/s/blog_56d8ea9001013frw.html
非中央仓库的应该设置在 pom.xml
https://maven.apache.org/pom.html#repositories
在 settings.xml 中对中央仓库和非中央仓库进行镜像
(镜像无法设置是否启用快照 snapshots enabled)
https://maven.apache.org/settings.html#mirrors