Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Gradle cannot load MavenPomMetaInfoProvider because a build script still uses the old maven plugin

ErrorUnable 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.

  • Applies to Gradle 7, 8 and 9, Android Gradle plugin 8.x
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 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 --stacktrace
  2. 2Match what you see, then jump to its fix

    1. 1grep finds apply plugin: 'maven' or an uploadArchives blockYour own build script applies the removed maven pluginFix
    2. 2grep finds nothing in your files, and the stack trace names a plugin classA third-party plugin you apply was built against the old pluginFix

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 { ... } } block

3Verify

Run help; the class error is gone.

./gradlew help

Confirmed by docs.gradle.org

Did this fix it?

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 15

2Fix

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 --stacktrace

Confirmed by docs.gradle.org

Did this fix it?

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

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 fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.