Spring Boot Maven Plugin Not Found
Problem
When working with Spring Boot Maven projects, you may encounter the error: Plugin 'org.springframework.boot:spring-boot-maven-plugin:' not found. This error typically occurs in your pom.xml file and prevents successful project builds.
The Spring Boot Maven Plugin is essential for:
- Packaging executable JAR/WAR files
- Running Spring Boot applications
- Building Docker images
- Creating efficient self-contained applications
Root Causes
This error can have several underlying causes:
- Missing version specification: The plugin version isn't explicitly defined
- Network issues: Dependencies failed to download due to connectivity problems
- Maven configuration: Incorrect IDE or Maven settings
- Version conflicts: Incompatible Spring Boot versions
- Project structure: Multi-module projects with inheritance issues
Solutions
1. Add Version Specification (Recommended)
The most common solution is to explicitly specify the plugin version that matches your Spring Boot parent version:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${project.parent.version}</version>
</plugin>
</plugins>
</build>This approach ensures the plugin version stays synchronized with your Spring Boot version.
2. Force Maven Dependency Update
WARNING
Before proceeding, ensure you have a stable internet connection as this process downloads dependencies.
For IntelliJ IDEA:
- Right-click your project → Maven → Reload Project
- Use the Maven toolbar to run
cleantheninstalllifecycle phases - Go to File → Invalidate Caches / Restart
For Eclipse/STS:
- Right-click project → Run As → Maven clean
- Right-click project → Run As → Maven install
- Right-click project → Maven → Update Project (enable "Force Update")
Command Line:
mvn clean install3. Verify Maven Configuration
Check your IDE's Maven settings:
IntelliJ IDEA:
- Preferences → Build, Execution, Deployment → Build Tools → Maven
- Ensure "Use plugin registry" is checked
- Verify Maven home directory is correctly set
4. Check Network and Firewall Settings
Network restrictions can prevent Maven from downloading dependencies:
- Add your IDE to firewall exceptions
- Verify proxy settings if working in corporate environments
- Test with a different network connection
5. Verify Java Version Compatibility
Ensure your Java version matches the project requirements:
<properties>
<java.version>1.8</java.version>
<!-- For newer Maven versions -->
<maven.compiler.release>8</maven.compiler.release>
</properties>In IntelliJ, verify: Project Structure → Project → Language level matches your Java version.
6. Multi-module Project Solution
For projects where Spring Boot is a "grandparent" dependency:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>3.2.0</version> <!-- Specify exact version -->
</plugin>Complete Working Example
Here's a properly configured pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.1</version>
<relativePath/>
</parent>
<groupId>dev.che</groupId>
<artifactId>stu</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>stu</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Other dependencies -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${project.parent.version}</version>
</plugin>
</plugins>
</build>
</project>Prevention Tips
- Use Spring Initializr: Always generate projects from start.spring.io to ensure proper configuration
- Version Management: Use
${project.parent.version}for plugin versions to maintain consistency - Regular Updates: Keep your IDE and Maven installation updated
- Network Reliability: Ensure stable internet for dependency downloads
TIP
If problems persist after trying these solutions, consider creating a new project using Spring Initializr and migrating your code, as this often resolves hidden configuration issues.
When to Use Specific Versions
While using ${project.parent.version} is recommended, there are cases where specifying an exact version is necessary:
- Multi-module projects with complex inheritance
- When using Snapshots or milestone releases
- Corporate environments with strict dependency management policies
<version>3.2.0</version> <!-- Replace with your specific version -->By following these solutions, you should be able to resolve the "Plugin not found" error and successfully build your Spring Boot Maven project.