在国内连接 Maven 官方的中央库会出现Connection timed out问题。 出错提示

[ERROR] Failed to execute goal on project gs-maven: Could not resolve dependencies for project org.springframework:gs-maven:jar:0.1.0: Failed to collect dependencies at joda-time:joda-time:jar:2.2: Failed to read artifact descriptor for joda-time:joda-time:jar:2.2: Could not transfer artifact joda-time:joda-time:pom:2.2 from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.16.215] failed: Connection timed out: connect -> [Help 1]

解决办法有:

1.在.m2/settings.xml中添加国内的镜像站,例如

    <mirror>
        <id>nexus-aliyun</id>
        <mirrorOf>*</mirrorOf>
        <name>Nexus aliyun</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public</url>
    </mirror>

下载settings.xml文件

2.IntelliJ IDEA中配置自定义的settings.xml文件

 

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐