Gradle cannot load MavenPomMetaInfoProvider because a build script still uses the old maven plugin
Unable to load class 'org.gradle.api.publication.maven.internal.MavenPomMetaInfoProvider'Short answer
Gradle 7.0 removed the legacy maven plugin. A build file or an old plugin that still applies it asks for a class that no longer exists. Find who applies it, then move your own script to maven-publish or update the plugin.
Fix it fast
1Find out which cause you have
Search the whole project, including build-logic folders, for the old plugin and for uploadArchives. Then read the stack trace to see which plugin asked for the class.
grep -rn "apply plugin: 'maven'\|id 'maven'\|uploadArchives" --include=*.gradle --include=*.kts . ./gradlew help --stacktrace2Match what you see, then jump to its fix
What does the error look like?
Unable to load class 'org.gradle.api.publication.maven.internal.MavenPomMetaInfoProvider'
Cause 1 of 2
Your own build script applies the removed maven plugin
1Check
Gradle's upgrade notes for 7.0 say the maven plugin has been removed and that maven-publish should be used. uploadArchives went with it.
grep -rn "uploadArchives\|plugin: 'maven'" --include=*.gradle .2Fix
Replace the plugin with maven-publish and describe what you publish in a publishing block. Follow Gradle's Maven Publish plugin guide for the details of your artifact.
plugins {
id 'maven-publish'
}
// then add a publishing { publications { ... } repositories { ... } } block3Verify
Run help; the class error is gone.
./gradlew helpConfirmed by docs.gradle.org
Cause 2 of 2
A third-party plugin you apply was built against the old plugin
1Check
The stack trace shows which plugin class triggered the load. If it belongs to a plugin in your buildscript classpath, that version predates Gradle 7.
./gradlew help --stacktrace 2>&1 | grep -i "plugin" | head -n 152Fix
Raise that plugin to a release that supports your Gradle version, or drop it if maven-publish already does the job.
// root build.gradle or version catalog: change the plugin line to
// the version its release notes list as compatible with your Gradle.3Verify
Run help again; the stack trace no longer mentions the class.
./gradlew help --stacktraceConfirmed by docs.gradle.org
How do I stop it coming back?
- Read the Gradle upgrade notes for each major version before you move the wrapper.
- Keep plugin versions current; old ones are the usual carriers of removed APIs.
- Run the build with the Gradle version you ship on before merging a wrapper bump.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Mobile apps
Gradle cannot find the compile() method in build.gradle
Could not find method testCompile() for arguments
Gradle 7 removed the compile and runtime configurations, so a dependencies block that still says compile fails.
2 causes, each with a fixMobile apps
adb cannot start because something already holds its port
adb start-server failed
The adb server must bind local TCP port 5037, and every adb client talks to it there.
2 causes, each with a fixMobile apps
The phone shows as unauthorized and Android Studio will not run the app
adb devices lists the phone but Android Studio cannot deploy to it
An unauthorized phone means it has not trusted this computer's RSA key.
3 causes, each with a fixMobile apps
Android Studio cannot pair the phone over Wi-Fi
The Pair devices over Wi-Fi dialog lists no device
Wireless pairing needs the phone on Android 11 or higher and on the same Wi-Fi network as the computer, with current Platform-Tools.
4 causes, each with a fixMobile apps
adb cannot connect to its daemon or start the server
* daemon started successfully *
The adb server is a background process on your computer that listens on TCP port 5037.
2 causes, each with a fixMobile apps
adb prints 'server version doesn't match this client; killing...'
adb server version doesn't match this client; killing...
adb runs a background server, and every adb command is a client.
3 causes, each with a fix