背景
我在新建微服务项目的时候,使用gradle报错Connect to 127.0.0.1:1087 [/127.0.0.1] failed: Connection refused
。然后我检查了一下IDEA的代理设置,没有使用代理。
报错信息
A problem occurred configuring root project 'microcloud'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:2.2.5.RELEASE.
Required by:
project :
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:2.2.5.RELEASE.
> Could not get resource 'https://maven.aliyun.com/repository/public/org/springframework/boot/spring-boot-gradle-plugin/2.2.5.RELEASE/spring-boot-gradle-plugin-2.2.5.RELEASE.pom'.
> Could not GET 'https://maven.aliyun.com/repository/public/org/springframework/boot/spring-boot-gradle-plugin/2.2.5.RELEASE/spring-boot-gradle-plugin-2.2.5.RELEASE.pom'.
> Connect to 127.0.0.1:1087 [/127.0.0.1] failed: Connection refused (Connection refused)
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
从Connect to 127.0.0.1:1087 中可以看出,应该是我之前设置了什么代理服务器
解决办法
编辑用户目录下的.gradle/gradle.properties文件。
vim ~/.gradle/gradle.properties
删除或者注释systemProp.http与systemProp.https开头的配置。
然后问题就成功解决了。