HarmonyOS鸿蒙Next工程build.gradle构建时Could not HEAD repo.ark.tools.huawei.com,如何修改maven地址?

HarmonyOS鸿蒙Next工程build.gradle构建时Could not HEAD repo.ark.tools.huawei.com,如何修改maven地址? 先上报错

A problem occurred configuring root project 'Image'.
> Could not resolve all artifacts for configuration ':classpath'.
    > Could not resolve com.huawei.ohos:hap:3.0.3.4.
        Required by:
            project :
        > Could not resolve com.huawei.ohos:hap:3.0.3.4.
            > Could not get resource 'http://repo.ark.tools.huawei.com/artifactory/maven-public/com/huawei/ohos/hap/3.0.3.4/hap-3.0.3.4.pom'.
                   > Could not HEAD 'http://repo.ark.tools.huawei.com/artifactory/maven-public/com/huawei/ohos/hap/3.0.3.4/hap-3.0.3.4.pom'. Received status code 504 from server: Gateway Time-out
    > Could not resolve com.huawei.ohos:decctest:1.2.6.0.
        Required by:
            project :
        > Could not resolve com.huawei.ohos:decctest:1.2.6.0.
            > Could not get resource 'http://repo.ark.tools.huawei.com/artifactory/maven-public/com/huawei/ohos/decctest/1.2.6.0/decctest-1.2.6.0.pom'.
                   > Could not HEAD 'http://repo.ark.tools.huawei.com/artifactory/maven-public/com/huawei/ohos/decctest/1.2.6.0/decctest-1.2.6.0.pom'. Received status code 504 from server: Gateway Time-out
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'Image'.
...

更多关于HarmonyOS鸿蒙Next工程build.gradle构建时Could not HEAD repo.ark.tools.huawei.com,如何修改maven地址?的实战教程也可以访问 https://www.itying.com/category-93-b0.html

4 回复

解决了,配置http代理,增加*.huawei.com

image.png

更多关于HarmonyOS鸿蒙Next工程build.gradle构建时Could not HEAD repo.ark.tools.huawei.com,如何修改maven地址?的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


欢迎开发小伙伴们进来帮帮楼主

在HarmonyOS鸿蒙Next工程中,遇到Could not HEAD repo.ark.tools.huawei.com错误,通常是由于Maven仓库地址无法访问或配置不正确导致的。你可以通过修改build.gradle文件中的Maven仓库地址来解决这个问题。

  1. 打开项目中的build.gradle文件。
  2. 找到repositories部分,检查是否有repo.ark.tools.huawei.com的配置。
  3. 如果存在,将其替换为可用的Maven仓库地址,例如华为官方的Maven仓库地址:
repositories {
    maven { url 'https://repo.huaweicloud.com/repository/maven/' }
    mavenCentral()
}
  1. 保存文件并重新构建项目。

如果问题仍然存在,确保网络连接正常,并且防火墙或代理没有阻止访问Maven仓库。

在HarmonyOS鸿蒙Next工程中,遇到“Could not HEAD repo.ark.tools.huawei.com”错误,通常是由于Maven仓库地址无法访问。解决方法如下:

  1. 打开build.gradle文件。
  2. 找到repositories部分,将原有的Maven仓库地址替换为可用的镜像地址,例如:
    repositories {
        maven { url 'https://maven.aliyun.com/repository/public' }
        mavenCentral()
    }
    
  3. 保存并重新构建项目。

确保网络连接正常,并检查防火墙或代理设置是否阻止了访问。

回到顶部