Android gradle uploadArchives when when building


(Kirill Zotov) #1

I have my uploadArhives to Maven repository .aar publishing.

But I have to run gradlew uploadArhives from the console all the time, how to code to make it invoke with every build or with release build?

uploadArchives {
repositories {
mavenDeployer {
def credentials = [
userName: NEXUS_USERNAME,
password: NEXUS_PASSWORD
]
repository(url: MAVEN_REPO_URL, authentication: credentials)
pom.artifactId = 'aaa’
pom.version = version
pom.packaging = 'aar’
pom.groupId = ‘bbb’

    }
}

}

As I think, we can define function

def uploadToMaven = {
uploadArchives
}
But how to execute it with every build?