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.
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:
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.
Run:
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.
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:
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:
- Confirm the wrapper version with
./gradlew --version. - Check whether the build uses
build.gradleorbuild.gradle.kts. - Ensure the Spring Boot plugin declaration includes a valid version.
- Inspect
settings.gradleforpluginManagementif a custom mirror or restricted network is involved. - 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
pluginManagementwhen custom repository configuration is needed. - Do not mix Groovy DSL and Kotlin DSL syntax.
- Prefer the plugins DSL for modern builds and keep legacy
buildscriptusage isolated. - Use
./gradlewconsistently so local and CI behavior match.
Related reading
- spring-boot health not showing details withDetail info
- Spring-Boot How do I set JDBC pool properties like maximum number of connections?
- Spring-Boot How to properly inject javax.validation.Validator
- Spring-Boot logging to Kafka how to eliminate warning; best practices
- Spring-Boot logging with log4j2?
- Spring-Boot MVC Template Not Loading 404 Not Found
- Spring-boot required a bean named 'entityManagerFactory' that could not be found
- spring-boot without parent pom.xml cannot generate war packaging

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseTrack 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.