Connect to repo.maven.apache.org:443 [repo.maven.apache.org/127.0.0.1]

maven logo
image-3249

构建问题

遇到这个问题,先检查maven的配置或者gradle的配置,将其中的仓库修改为如下.

Maven

maven\conf\settings.xml

对比修改为如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<mirrors>
    <!-- mirror
    | Specifies a repository mirror site to use instead of a given repository. The repository that
    | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
    | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
    |
   <mirror>
     <id>mirrorId</id>
     <mirrorOf>repositoryId</mirrorOf>
     <name>Human Readable Name for this Mirror.</name>
     <url>http://my.repository.com/repo/path</url>
   </mirror>
    -->
    <!--阿里云镜像1-->
    <mirror>
      <id>aliyunId</id>
      <mirrorOf>central</mirrorOf>
      <name>aliyun maven</name>
      <url>https://maven.aliyun.com/repository/central</url>
    </mirror>
     <!--阿里云镜像2-->
    <mirror>
      <id>alimaven</id>
      <mirrorOf>central</mirrorOf>
      <name>aliyun maven</name>
      <url>https://maven.aliyun.com/nexus/content/groups/public/</url>
    </mirror>
     <!--阿里云镜像3-->
    <mirror>
      <id>alimaven</id>
      <mirrorOf>central</mirrorOf>
      <name>aliyun maven</name>
      <url>https://maven.aliyun.com/nexus/content/repositories/central/</url>
    </mirror>
     <!--阿里云镜像4-->
     <mirror>
      <id>alimaven</id>
      <mirrorOf>central</mirrorOf>
      <name>aliyun maven</name>
      <url>https://central.maven.org/maven2</url>
    </mirror>
    <!--maven官方镜像-->
     <mirror>
      <id>mirrorId</id>
      <mirrorOf>central</mirrorOf>
      <name>Human Readable Name</name>
      <url>https://repol.maven.org/maven2/</url>
    </mirror>
  </mirrors>

Gradle

build.gradle文件.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
buildscript {
    repositories {
        maven { url 'https://maven.aliyun.com/repository/gradle-plugin' } //gradle-plugin
        maven { url 'https://maven.aliyun.com/repository/google' } //google
        maven { url 'https://maven.aliyun.com/repository/public' } //public
        maven { url 'https://maven.aliyun.com/repository/jcenter'} //jcenter
        /*mavenCentral()
        jcenter()
        google()*/
    }
}

allprojects {
    repositories {
        maven { url 'https://maven.aliyun.com/repository/gradle-plugin' } //gradle-plugin
        maven { url 'https://maven.aliyun.com/repository/google' } //google
        maven { url 'https://maven.aliyun.com/repository/public' } //public
        maven { url 'https://maven.aliyun.com/repository/jcenter'} //jcenter
        /*mavenCentral()
        jcenter()
        google()*/
    }
}

dns问题

可以尝试将电脑dns修改为国内的公共dns.

比如:

阿里dns: https://www.alidns.com/
百度dns: https://dudns.baidu.com/index.html
114dns: http://www.114dns.com/

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

*

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据