๐ด The Error You're Seeing
Confirm this matches your console output. If it does, you're in the right place.
[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)
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>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>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>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>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
Parent POM manages plugins.
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.