Ubuntu 16.04下Spring Boot项目Gradle构建失败求助
Hey there, let's tackle this Gradle build error you're facing. That Failed to notify project evaluation listener. org.gradle.api.Project.getPluginManager()Lorg/gradle/api/plugins/PluginManager; message is a dead giveaway that you're dealing with a version compatibility issue—most likely between your installed Gradle version and the Spring Boot Gradle plugin, or an outdated Gradle setup on Ubuntu 16.04.
Here's how to fix it step by step:
1. Check Your Current Gradle Version
First, let's confirm what Gradle version you're running. Open your terminal, navigate to your project root, and run:
./gradlew --version
Ubuntu 16.04's default repositories ship with a really old Gradle version (usually 2.x), which is way too outdated for modern Spring Boot projects. Spring Boot 2.x requires at least Gradle 4.x, and Spring Boot 3.x needs Gradle 7.x or higher.
2. Upgrade Gradle (Recommended: Use Gradle Wrapper)
The Gradle Wrapper is the best approach here—it ensures your project uses the exact Gradle version it needs, regardless of what's installed on your system.
- Go to your project's
gradle/wrapper/gradle-wrapper.propertiesfile. - Update the
distributionUrlto a version compatible with your Spring Boot plugin. For example, if you're using Spring Boot 2.7.x, use Gradle 7.5:distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip - Save the file, then run your build again:
The wrapper will automatically download the correct Gradle version and use it for your build../gradlew clean build
Alternative: Global Gradle Upgrade (Not Recommended)
If you prefer a system-wide upgrade (note: this can cause conflicts with other projects needing different Gradle versions):
- Uninstall the old Gradle version:
sudo apt remove --purge gradle - Download the latest compatible Gradle binary zip from the official Gradle site.
- Unzip it to
/opt/gradle:sudo unzip gradle-x.x-bin.zip -d /opt/gradle - Add Gradle to your system path by editing
~/.bashrc:
Add these lines at the end:nano ~/.bashrcexport GRADLE_HOME=/opt/gradle/gradle-x.x export PATH=$GRADLE_HOME/bin:$PATH - Save and exit, then reload your bash profile:
source ~/.bashrc - Verify the upgrade with
gradle --version.
3. Ensure Spring Boot Plugin & Gradle Version Compatibility
Double-check that your Spring Boot plugin version in build.gradle matches your Gradle version. Here's a quick compatibility cheat sheet:
- Spring Boot 2.0.x → Gradle 4.0+
- Spring Boot 2.1.x → Gradle 4.4+
- Spring Boot 2.2.x → Gradle 5.4+
- Spring Boot 2.3.x → Gradle 5.6.4+
- Spring Boot 2.4.x → Gradle 6.3+
- Spring Boot 2.5.x → Gradle 6.7+
- Spring Boot 2.6.x → Gradle 7.0+
- Spring Boot 2.7.x → Gradle 7.3+
- Spring Boot 3.x → Gradle 7.5+
4. Clean Build Cache
Sometimes cached files can cause unexpected issues. Try running a build without the cache:
./gradlew clean build --no-build-cache
That should resolve the getPluginManager() error. The most common culprit here is Ubuntu's outdated default Gradle, so using the wrapper is the safest way to avoid this in the future.
内容的提问来源于stack exchange,提问作者Mahmoud Nabegh

