Gradle Core Plugins (plugin is not in 'org.gradle' namespace) 错误提示,如何解决?

关于Intellij IDEA 创建Springboot 项目 选择Gradle自动化构建,有可能会产生Gradle Core Plugins (plugin is not in ‘org.gradle’ namespace) 错误。

这个问题可以通过自建Nexus3后,修改Gradle的build.gradle和settings.gradle来解决:

Nexus3通过docker搭建的方法可参考:
https://hub.docker.com/r/sonatype/nexus3

build.gradle :

plugins {
	id 'org.springframework.boot' version '2.2.0.M3'
	id 'java'
}

apply plugin: 'io.spring.dependency-management'

group = 'com.test'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories {
	maven { url 'http://localhost:8081/repository/maven-public/' }
}

dependencies {
	implementation 'org.springframework.boot:spring-boot-starter-web'
	testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

test {
	useJUnitPlatform()
}

settings.gradle :

pluginManagement {
	repositories {
		maven { url 'http://localhost:8081/repository/maven-public/' }
		gradlePluginPortal()
	}

	resolutionStrategy {
		eachPlugin {
			if (requested.id.id == 'org.springframework.boot') {
				useModule("org.springframework.boot:spring-boot-gradle-plugin:${requested.version}")
			}
		}
	}
}
rootProject.name = 'demo'

你可能感兴趣的:(springboot)