Skip to content

How to resolve Plugin [id: 'org.springframework.boot', version: '2.4.2.RELEASE', apply: false] was not found in any of the following sources

Problem

When running a Spring Boot application with Gradle, the following error might occur:

15:46:15: Executing task 'bootRun'...
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/bswen/private/bw/bswen-github/bswen-springboot23/build.gradle' line: 22
* What went wrong:
Plugin [id: 'org.springframework.boot', version: '2.4.2.RELEASE', apply: false] 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.4.2.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 2s
15:46:18: Task execution finished 'bootRun'.

The core exception is:

Plugin [id: 'org.springframework.boot', version: '2.4.2.RELEASE', apply: false] 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.4.2.RELEASE')
Searched in the following repositories:
Gradle Central Plugin Repository

Environment

  • SpringBoot 2.x
  • Gradle 6.x

The configurations

Let’s check the project’s build.gradle:

build.gradle
group 'com.bswen.app9'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.3.2.RELEASE")
}
}
plugins {
id 'org.springframework.boot' version '2.4.2.RELEASE' apply false
id 'io.spring.dependency-management' version '1.0.11.RELEASE' apply false
id 'java'
}
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/milestone' }
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
}

Solution

We should notice that the plugin org.springframework.boot’s version is 2.4.2.RELEASE, but there is no version named 2.4.2.RELEASE. We should use 2.4.2 instead.

Change as follows:

Change from:

plugins {
id 'org.springframework.boot' version '2.4.2.RELEASE' apply false
id 'io.spring.dependency-management' version '1.0.11.RELEASE' apply false
id 'java'
}

To:

plugins {
id 'org.springframework.boot' version '2.4.2' apply false
id 'io.spring.dependency-management' version '1.0.11.RELEASE' apply false
id 'java'
}

Rebuild the project and run it:

image-20210220161353910

It works!

All the example code and config files can be found in this GitHub project.

Summary

This post demonstrated how to resolve the “Plugin not found” error in a Spring Boot application using Gradle. The key solution was to correct the plugin version in the build.gradle file by removing the .RELEASE suffix. Ensuring the correct plugin version and proper repository configuration are crucial for resolving such issues. Always verify the available plugin versions and repository configurations to avoid similar problems.

Final Words + More Resources

My intention with this article was to help others who might be considering solving such a problem. So I hope that’s been the case here. If you still have any questions, don’t hesitate to ask me by email: Email me

Here are also the most important links from this article along with some further resources that will help you in this scope:

Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!