unable to resolve class MavenDeployment after updating the gradle wrapper

Viewed 5839

Android Studio offered me to update the gradle wrapper and I accepted.

After the update process it updated the wrapper to the version 7.0.2.

Now I'm getting the following error on my project:

unable to resolve class MavenDeployment 
        @ line 30, column 34.
        beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
        ^
        1 error

It is a library project and I'm using the following guide (and script) for publishing it on MavenCentral: simple library publishing with Gradle

It seems it is no longer resolving the class MavenDeployment from the maven plugin:

apply plugin: 'maven'

Exatly at this point on the script:

afterEvaluate { project ->
    uploadArchives {
            repositories {
                    mavenDeployer {
                            beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
...

I'm not a gradle expert. How can I resolve this error?

2 Answers

Finally identified the problem: The old maven plugin is deprecated in the new gradle versions.

If you are experiencing this error you need to rewrite your script to use Maven Publish Plugin

Meeting the same problem. I build successfully with the updated version to 5.3.

Related