在idea上使用Gradle构建springboot项目时报如下错误

* Where:
Build file 'F:\customProject\example\build.gradle' line: 2

* What went wrong:
Plugin [id: 'org.springframework.boot', version: '2.1.5.RELEASE'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'org.springframework.boot:org.springframework.boot.gradle.plugin:2.1.5.RELEASE')
  Searched in the following repositories:
    Gradle Central Plugin Repository

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

CONFIGURE FAILED in 302ms
  • 发现是因为启动了离线模式,不会联网下在jar包
    image.png

  • 但是maven上有Work_offline选项,而2019以上版本的idea中Gradle是没有这个选项的

解决办法(二种方式):

  1. 在命令行中输入
gradle build --offlline
  1. 不点击如下的按钮
    image.png

没想到就因为这个,我花了周日一个下午的时间, ̄□ ̄||

上一篇 下一篇