Gradle Core Plugins (plugin is not in 'org.gradle' namespace)

记录一个由 gradle 构建项目遇到的问题:

起因:项目原先运行正常,不过个人 移除掉默认仓库  .gradle 仓库后,重新拉取报错如下:

FAILURE: Build failed with an exception.

* Where:
Build file 'F:\ideaSpace\insuranceService\build.gradle' line: 13

* What went wrong:
Plugin [id: 'org.springframework.boot', version: '2.2.4.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.2.4.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

BUILD FAILED in 0s
19:10:18: Task execution finished 'clean'.

这是 build.gradle 文件的内容

buildscript {
	repositories {
		maven {
			url "http://maven.aliyun.com/nexus/content/groups/public"
		}
		maven {
			url 'https://maven.aliyun.com/repository/gradle-plugin'
		}
	}
}

plugins {
	id 'org.springframework.boot' version '2.2.4.RELEASE'
	id 'io.spring.dependency-management' version '1.0.9.RELEASE'
	id 'java'
}

网上查询大多说是插件引用不对:

以下罗列出找到的2个方法(针对我的项目都无法解决,期望对查阅者有帮助),还有第三种,是摸索出来的,可解决(请各位对症下药)

第一种:修改插件引用形式

https://blog.triplez.cn/err-and-solution-of-config-gradle-idea-env/

第二种:下载插件引用不到的情况

* What went wrong:
A problem occurred configuring root project 'MyApp'.
> Could not resolve all files for configuration ':classpath'.
   > Could not download jimfs.jar (com.google.jimfs:jimfs:1.1)
      > Could not get resource 'https://plu

https://www.codercto.com/a/50093.html

第三种:需要查看你本地用的JDK,是 一般的JDK 还是 OpenJDK, 如果是用OpenJDK,请切换到一般的JDK,,并把项目目录下的 .idea 内 workspace.xml 删除 , 并把项目 clean (不能clean,则手动移除项目目录下生成的构建包 .build 、 .gradle、out )

Gradle Core Plugins (plugin is not in 'org.gradle' namespace)_第1张图片

Gradle Core Plugins (plugin is not in 'org.gradle' namespace)_第2张图片

关闭重启,重新拉取,就OK。

原因具体不太清楚,OpenJDK 安装在 mac电脑 可以直接拉取,在windows环境,经常会错出这类错误

你可能感兴趣的:(ERROR,gradle)