๐Ÿ”ด The Error You're Seeing

Confirm this matches your console output. If it does, you're in the right place.

ERROR LOG[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.1.1:analyze (default-cli) on project my-app: Cannot find dependencies of the project -> [Help 1]

โšก Quick Fix Works 80% of the time

Add the spring-boot-starter-parent to the <parent> block of your pom.xml.

<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>3.2.0</version> </parent>

๐Ÿง  Why this Happens

Tap to expand the deep technical explanation

You are missing the `<parent>` declaration in your `pom.xml`. The `spring-boot-starter-parent` provides default versions for Maven plugins (like `maven-dependency-plugin` and `maven-compiler-plugin`) and dependencies. Without it, Maven doesn't know which versions to use and fails to resolve them.

The HITEC City Parking Spot Analogy:

It's like trying to build a car but forgetting to include the engine block. The individual parts (plugins) exist, but without the main chassis (parent POM) to organize them, the factory (Maven) cannot assemble the vehicle.

๐Ÿ” How to Reproduce Confirm this is your error

Create a `pom.xml` with `<packaging>jar</packaging>` but no `<parent>` block. Add `spring-boot-starter-web` as a dependency without a version. Run `mvn clean install`.

๐Ÿ› ๏ธ Solutions (5 Ways to Fix)

Solution 1โœ“ Most common cause

Add the Spring Boot Parent POM

๐Ÿ‘‰ Use this as the primary fix for missing plugin versions.

The parent POM manages all plugin versions and dependency versions for you.

<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>3.2.0</version> <relativePath/> <!-- lookup parent from repository --> </parent>
Solution 2

Explicitly define plugin versions

๐Ÿ‘‰ Use this if you cannot use the parent POM (e.g., you are inheriting from a different corporate parent).

If you can't use `spring-boot-starter-parent`, you must manually define every plugin and its version in `<build><plugins>`.

<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>3.6.1</version> </plugin> </plugins> </build>
Solution 3

Add <pluginRepositories> if behind a corporate firewall

๐Ÿ‘‰ Use this if you have the parent POM but Maven still can't find plugins.

Corporate networks might block the default Maven Central plugin repository. You must explicitly declare the repository.

<pluginRepositories> <pluginRepository> <id>central</id> <url>https://repo.maven.apache.org/maven2</url> </pluginRepository> </pluginRepositories>
Solution 4

Update Maven settings.xml

๐Ÿ‘‰ Use this if your `settings.xml` is overriding repositories with a dead Nexus URL.

Check `~/.m2/settings.xml`. If it points to an old corporate repository that is offline, Maven will fail to find basic plugins.

<!-- ~/.m2/settings.xml --> <mirrors> <mirror> <id>central-mirror</id> <url>https://repo.maven.apache.org/maven2</url> <mirrorOf>*</mirrorOf> </mirror> </mirrors>
Solution 5

Force Maven to update snapshots

๐Ÿ‘‰ Use this if the parent POM was recently updated but Maven is using a cached, broken version.

The `-U` flag forces Maven to check for updated versions of plugins and parent POMs.

mvn clean install -U

๐Ÿ“‹ Version Notes

Spring Boot 2.x

Parent POM manages plugins.

Spring Boot 3.x

Parent POM manages plugins, requires Java 17.

๐Ÿ›ก๏ธ How to Prevent This Next Time

Always use Spring Initializr (start.spring.io) to generate your project skeleton. It guarantees the `<parent>` block is correctly configured.

Course Search
Search across all chapters & stages
๐Ÿ“–

Search the course

Type any topic โ€” branching, stash, rebase, hooks โ€” and jump straight to that chapter.

merge branchesgit stashundo commitrebase