spring-boot
gradle
plugin-not-found
build-tool-issues
dependency-management

spring-boot gradle plugin can't be found

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

Introduction

When Gradle says the Spring Boot plugin cannot be found, the build is usually failing very early in plugin resolution. That means the problem is often not Spring code at all. It is usually a mismatch between plugin syntax, repository configuration, Gradle version, or the way the project was initialized.

Where Plugin Resolution Happens

Gradle resolves plugins before it resolves normal dependencies. That distinction matters because developers often add repositories in the wrong place and expect plugin lookup to start working.

There are two common ways to apply the Spring Boot plugin.

The modern approach uses the plugins block:

gradle
1plugins {
2    id 'java'
3    id 'org.springframework.boot' version '3.3.5'
4    id 'io.spring.dependency-management' version '1.1.6'
5}
6
7group = 'com.example'
8version = '1.0.0'
9
10repositories {
11    mavenCentral()
12}
13
14dependencies {
15    implementation 'org.springframework.boot:spring-boot-starter-web'
16    testImplementation 'org.springframework.boot:spring-boot-starter-test'
17}

An older style uses buildscript plus apply plugin:. That still appears in legacy projects, but mixing old and new styles without understanding the difference is a common source of confusion.

The Most Common Reasons It Fails

One cause is using a plugins block in an environment where Gradle itself is too old to support the expected plugin behavior. Another is omitting the plugin version. Gradle cannot infer it unless your build uses a version catalog or a centralized plugin management setup.

A third cause is corporate proxy or mirror configuration. Dependency resolution might work for ordinary artifacts while plugin resolution fails because it uses different settings or repositories.

A fourth cause is copying an example written for build.gradle.kts into build.gradle, or the reverse. The syntax looks similar but is not interchangeable.

Check the Wrapper First

The wrapper is the first file to inspect because it controls which Gradle version the project actually uses.

properties
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip

Run:

bash
./gradlew --version

If the wrapper is too old for the Spring Boot plugin version in your build, resolution or configuration can fail before any useful task runs. In team environments, always prefer the wrapper over a locally installed Gradle binary so everyone resolves plugins the same way.

Use the Right File for Repository Logic

If your environment needs explicit plugin repositories, configure them in settings.gradle or settings.gradle.kts using pluginManagement, not only in the project repositories block.

gradle
1pluginManagement {
2    repositories {
3        gradlePluginPortal()
4        mavenCentral()
5    }
6}
7
8rootProject.name = 'demo-app'

This is a subtle but important point. The repositories block in build.gradle affects normal dependencies. Plugin resolution may happen earlier, so plugin repositories belong in plugin management.

Legacy Buildscript Example

If you are maintaining an older build, you may still see this style:

gradle
1buildscript {
2    repositories {
3        mavenCentral()
4    }
5    dependencies {
6        classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.7.18'
7    }
8}
9
10apply plugin: 'java'
11apply plugin: 'org.springframework.boot'

This works in legacy projects, but you should not mix it casually with the plugins DSL for the same plugin. Pick one approach and make it coherent.

A Practical Debugging Sequence

When the plugin cannot be found, debug in this order:

  1. Confirm the wrapper version with ./gradlew --version.
  2. Check whether the build uses build.gradle or build.gradle.kts.
  3. Ensure the Spring Boot plugin declaration includes a valid version.
  4. Inspect settings.gradle for pluginManagement if a custom mirror or restricted network is involved.
  5. Run a clean plugin-resolution attempt with ./gradlew help --refresh-dependencies.

This order matters because it separates syntax problems from environment problems.

When the Error Is Really About Network Access

If the version and syntax are correct, the next suspect is repository access. In restricted networks, Gradle may be unable to reach the plugin portal. The fix is usually to point plugin management at the approved internal repository or configure the proxy correctly.

If you see this only on CI and not locally, compare:

  • wrapper version
  • 'settings.gradle'
  • proxy settings
  • mirror configuration
  • environment variables used by the build agent

The plugin itself is often fine. The resolution path is what differs.

Common Pitfalls

The biggest mistake is adding mavenCentral() under project repositories and assuming that solves plugin resolution. It may not.

Another common issue is copying Kotlin DSL syntax into a Groovy build file. A build can then fail with a plugin error even though the root cause is syntax mismatch.

Do not mix the old buildscript mechanism and the new plugins DSL unless you have a clear reason. It complicates troubleshooting.

Finally, avoid running a random system Gradle binary. Use ./gradlew so the build runs against the version declared by the project.

Summary

  • Spring Boot plugin resolution happens before normal dependency resolution.
  • Check the Gradle wrapper version first.
  • Put plugin repositories in pluginManagement when custom repository configuration is needed.
  • Do not mix Groovy DSL and Kotlin DSL syntax.
  • Prefer the plugins DSL for modern builds and keep legacy buildscript usage isolated.
  • Use ./gradlew consistently so local and CI behavior match.

Related reading
Course
Intermediate
27 lessons
14 hours
OOD Fundamentals

Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

All Rights Reserved.