maven install 时出现下面的异常信息
[ERROR] Failed to execute goal on project xxx: Could not resolve dependencies for project xxx.jar:1.0.3-SNAPSHOT: Failed to collect dependencies for [junit:junit:jar:3.8.1 (test), org.apache.ibatis:ibatis-sqlmap:jar:2.3.4.726 (compile), mysql:mysql-connector-java:jar:5.1.13 (compile), c3p0:c3p0:jar:0.9.1.2 (compile), com.google.code.gson:gson:jar:2.3.1 (compile), org.slf4j:slf4j-api:jar:1.7.7 (compile)]: Failed to read artifact de or for org.slf4j:slf4j-api:jar:1.7.+: Could not transfer artifact org.slf4j:slf4j-api:pom:1.7.+ from/to central (http://repo.maven.apache.org/maven2): connection timed out to http://repo.maven.apache.org/maven2/org/slf4j/slf4j-api/1.7.+/slf4j-api-1.7.+.pom -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
解决方法:
在项目的pom. 中指定私服中央仓库的url(其中host是你私服的ip,post是你私服的端口,如果不知道,可以找到settings. 文件,一般在开发网下,都会配置maven指定私服中央仓库下载)即可让项目去指定的仓库下载jar
<repositories>
<repository>
<id>central</id>
<url>http://host:post/nexus/content/groups/public</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://host:post/nexus/content/groups/public</url>
</pluginRepository>
</pluginRepositories>
继续阅读与本文标签相同的文章
21. 合并两个有序链表
打开第二代GS4的车门,里面藏着那个TA……
-
靠颜值进站!刷脸支付与轨道交通的大联合
2026-05-18栏目: 教程
-
打通“最后一公里”送药地图 访海派医药集团总经理张翔
2026-05-18栏目: 教程
-
上海首个保税展示展销场所亮相 海外商品“全球同质同价”
2026-05-18栏目: 教程
-
微信聊天记录导出excel使用方法分享卓师兄微信恢复大师
2026-05-18栏目: 教程
-
用好SmartArt,快速制作美观工整的PPT
2026-05-18栏目: 教程
