【换国内仓库】网络原因导致maven构建错误
基于Maven构建项目时,构建过程中可能出问题,如下:
1 | [WARNING] Failed to download maven-compiler-plugin-3.13.0.pom [[https://repo.maven.apache.org/maven2/]](https://repo.maven.apache.org/maven2/]) [WARNING] Failed to download maven-install-plugin-3.1.2.pom [[https://repo.maven.apache.org/maven2/]](https://repo.maven.apache.org/maven2/]) [WARNING] Failed to download maven-deploy-plugin-3.1.2.pom [[https://repo.maven.apache.org/maven2/]](https://repo.maven.apache.org/maven2/]) [WARNING] Failed to download maven-surefire-plugin-3.2.5.pom [[https://repo.maven.apache.org/maven2/]](https://repo.maven.apache.org/maven2/]) [WARNING] Failed to download maven-jar-plugin-3.4.1.pom [[https://repo.maven.apache.org/maven2/]](https://repo.maven.apache.org/maven2/]) [WARNING] Failed to download maven-resources-plugin-3.3.1.pom [[https://repo.maven.apache.org/maven2/]](https://repo.maven.apache.org/maven2/]) Cannot resolve plugin org.apache.maven.plugins:maven-install-plugin:3.1.2 Cannot resolve plugin org.apache.maven.plugins:maven-deploy-plugin:3.1.2 Cannot resolve plugin org.apache.maven.plugins:maven-compiler-plugin:3.13.0 Cannot resolve plugin org.apache.maven.plugins:maven-jar-plugin:3.4.1 Cannot resolve plugin org.apache.maven.plugins:maven-surefire-plugin:3.2.5 Cannot resolve plugin org.apache.maven.plugins:maven-resources-plugin:3.3.1 |
这通常是国内访问maven中央仓库中出现网络问题。解决办法:
方法1:开启系统科学上网的全局代理模式
方法2:在pom.xml
中添加如下国内镜像仓库地址
在 <project>
标签内添加如下内容:
1 | <repositories> |
- 标题: 【换国内仓库】网络原因导致maven构建错误
- 作者: 三葉Leaves
- 创建于 : 2024-11-07 00:00:00
- 更新于 : 2024-11-21 16:56:20
- 链接: https://leavesblog.netlify.app/cc9c80d8f9ef/
- 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。
评论