# Publishing in Gradle 5 migrating from 4.9

**URL:** https://discuss.gradle.org/t/publishing-in-gradle-5-migrating-from-4-9/32007
**Category:** Help/Discuss
**Created:** [June 5, 2019, 12:31pm UTC](https://discuss.gradle.org/t/publishing-in-gradle-5-migrating-from-4-9/32007 "2019-06-05T12:31:43Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![kmbisset89](https://avatars.discourse-cdn.com/v4/letter/k/ee59a6/32.png) [@kmbisset89](https://discuss.gradle.org/u/kmbisset89)
#### Post date: [June 5, 2019, 12:31pm UTC](https://discuss.gradle.org/t/publishing-in-gradle-5-migrating-from-4-9/32007/1 "2019-06-05T12:31:43Z")

</div>

am currently trying to upgrade my gradle wrapper from 4.9 to 5.3.1 and my publishToMavenLocal is no longer working. I knew this was going to happen from the release note but I cannot figure out how to get back to a functioning level. How can I get publish working in Gradle 5 with the code below?

I have added the Gradle recommend `afterEvaluate {}` block inside my code. I have tried in three different locations, which are the (#) in the code below.

//Code Block

```gradle
publishing {
    publications {
        // Publish the Android Archive and Javadoc (zip) all at once
        // To publish javadocs with archive, add the line: 'artifact androidJavadocsZip' below the library variants loop

            androidArchive(MavenPublication) {
                artifacts {
                    description 'Configuration Cleaner android archive'
                    groupId 'fda dp22'
                    artifactId 'Cleaner'
                    version version
                    afterEvaluate {
                    android.libraryVariants.all { variant ->
                        variant.outputs.each { output ->
                            if (variant.name == "release" && output.name == "release") {
                                artifact output.outputFile
                            } else {
                                logger.debug("Skipping Output " + output.name + " of type " + variant.name + ".")
                            }
                        }
                    }

                    artifact androidJavadocsZip
                    artifact androidJavadocsJar
                }
            }
        }
    }
}
```
