Skip to content

How to release an update to Maven Central as both aar and apklib

David Vavra edited this page Jan 2, 2014 · 1 revision

Prerequisities

  • I have used following two guides, go there in case of problems:
  • Sonatype OSS Maven Repository Usage Guide
  • Publish an aar file to Maven Central with Gradle
  • I have already added most of the required configurations to the project, but you need some setup on your machine. Particularly:
  • latest Java, Git, Maven, Gradle, Android SDK
  • GPG installed, public key distributed though their servers and path to the key and credentials in ~/.gradle/gradle.properties
  • Sonatype account and permissions to the project in Sonatype.

Release an update

  • Push all changes to git
  • setup target version in gradle.properties in project root
  • run gradle uploadArchives in project root
  • go to Staging repositories, select repository and click Close.
  • Note: It's important to push aar first, because they have different poms and you want the pom generated by Maven (differences are caused by different handling of support library in Maven and Gradle)
  • run mvn release:prepare and mvn release:perform in project root
  • go to Staging repositories, select repository and click Close.
  • verify the merged release - it will be in the this repo
  • You can add temporary staging repository - to settings.xml in Maven and to build.gradle in Gradle and test it out
  • when everything is fine, let's do the final push. Go to Staging repositories and click Release - aar first, apklib second
    • artefacts will be in Maven Central in about 2 hours