Gradle使用http://开头的仓库构建时报错

文章讲述了在构建过程中遇到Gradle报错,不允许使用不安全的HTTP协议来请求私有仓库。解决方案是在Maven配置中添加allowInsecureProtocol参数,设置为true,从而允许HTTP协议连接。

建了个私仓测试是用http://开头请求,结果构建时报了下面错误:

Using insecure protocols with repositories, without explicit opt-in, is unsupported. 
Switch Maven repository 'maven(http://xxx.xxx.xxx/repository/public/)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols. 
See https://docs.gradle.org/7.4.1/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details.

 看报错是因为使用vpn不安全连接下载依赖需要在maven里添加参数才可以访问http地址。

maven { 
        allowInsecureProtocol = true
        url 'http://xxx.xxx.xxx/repository/public/' 
      }

在此记录一下

A problem occurred configuring project ':com.biz-united.empower.code.saturn'. > Could not resolve all artifacts for configuration ':com.biz-united.empower.code.saturn:classpath'. > Could not find org.gradle:gradle-core:4.2. Searched in the following locations: - file:/Users/jiege/.m2/repository/org/gradle/gradle-core/4.2/gradle-core-4.2.pom - https://maven.aliyun.com/repository/central/org/gradle/gradle-core/4.2/gradle-core-4.2.pom - http://maven.biz-united.com.cn:28080/artifactory/libs-release-local/org/gradle/gradle-core/4.2/gradle-core-4.2.pom - https://repo.maven.apache.org/maven2/org/gradle/gradle-core/4.2/gradle-core-4.2.pom Required by: project :com.biz-united.empower.code.saturn > com.biz-united.empower.saturn:saturn-gradle-plugin:202109 > Could not find org.gradle:gradle-tooling-api:4.2. Searched in the following locations: - file:/Users/jiege/.m2/repository/org/gradle/gradle-tooling-api/4.2/gradle-tooling-api-4.2.pom - https://maven.aliyun.com/repository/central/org/gradle/gradle-tooling-api/4.2/gradle-tooling-api-4.2.pom - http://maven.biz-united.com.cn:28080/artifactory/libs-release-local/org/gradle/gradle-tooling-api/4.2/gradle-tooling-api-4.2.pom - https://repo.maven.apache.org/maven2/org/gradle/gradle-tooling-api/4.2/gradle-tooling-api-4.2.pom Required by: project :com.biz-united.empower.code.saturn > com.biz-united.empower.saturn:saturn-gradle-plugin:202109 Possible solution: - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
09-05
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Jet-W

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值