【新建Spring Boot项目】Connect to 127.0.0.1:1087 [/127.0.0.1] failed: Connection refused

背景

我在新建微服务项目的时候,使用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开头的配置。
【新建Spring Boot项目】Connect to 127.0.0.1:1087 [/127.0.0.1] failed: Connection refused_第1张图片
然后问题就成功解决了。
【新建Spring Boot项目】Connect to 127.0.0.1:1087 [/127.0.0.1] failed: Connection refused_第2张图片

参考

https://www.jianshu.com/p/0c1efb95178a

你可能感兴趣的:(排错,java,spring,boot)