Skip to content

AdityaBavadekar/MVN-Sample

Repository files navigation

Maven Central

View on Maven Central

MVN-Sample

How to upload to Maven Central

Note : Below step are assumes you Jira New Project ticket and thus a groupId.

  1. Create your library project.
  2. Create your github project and sync your local project with it.
  3. Copy build.gradle
  4. Copy-paste this into your local.properties file and modify as needed.
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file should *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=_TODO_SDK_PATH

ossrhUsername=_TODO_USERNAME
ossrhPassword=_TODO_PASSWORD

GROUP_ID=io.github.adityabavadekar
ARTIFACT_ID=mvn-sample
LIBRARY_PUBLIC_NAME=MVN Sample for Android Projects
LIBRARY_PUBLIC_DESCRIPTION=A concise description of my MVN-Sample library is that it is just a sample :) .
LIBRARY_GIT_URL=https://github.com/AdityaBavadekar/MVN-Sample
LIBRARY_INCEPTION_YEAR=2022
LIBRARY_LICENCE_NAME=The Apache License, Version 2.0
LIBRARY_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
LIBRARY_DEVELOPER_ID=AdityaBavadekar
LIBRARY_DEVELOPER_NAME=Aditya Bavadekar
LIBRARY_DEVELOPER_EMAIL=example@gmail.com
LIBRARY_SCM_CONNECTION=scm:git:git://github.com/mvn-sample.git
LIBRARY_SCM_URL=https://github.com/AdityaBavadekar/mvn-sample
  1. Use following commands:
>gpg --full-gen-key
# Copy last-8-DIGITS as KeyId.
>set keyId=PUT_YOUR_LAST_8_DIGITS
>cd mvn-sample # Or your project dir or some other dir where you want to save keyring.gpg
>gpg --export-secret-keys keyId > keyring.gpg # This will be PATH_TO_KEYRING_FILE
>gpg --keyserver keyserver.ubuntu.com --send-keys keyId # Requires network.
  1. Copy-paste this into gradle.properties (global)
#The keyId obtained in above step.
signing.keyId=YOUR_KEY_ID
#The password you used as passphrase while generating the GPG Key.
signing.password=PASSWORD
# Created in above step `gpg --export ...`
signing.secretKeyRingFile=PATH_TO_KEYRING_FILE
  1. Now your artifact will be in staging repositories.
  2. Go to https://s01.oss.sonatype.org/ and login with your credentials.
  3. Navigate to https://s01.oss.sonatype.org/#stagingRepositories
  4. Your artifact must be listed their. Eg: io.github.adityabavadekar-1010
  5. Click on that artifact, select Activity and if everything worked their should be a green success message.
  6. In the top select Close. Wait till it completes.
  7. Then again select artifact and select Release. Wait for 10-15 min.
  8. Congratulations 🎊 you artifact is published.

Go to here and find you groupId.

Use this Library in your project

TAG : Maven Central

  • Gradle
    implementation 'io.github.adityabavadekar:mvn-sample:TAG'
  • Maven
<dependency>
  <groupId>io.github.adityabavadekar</groupId>
  <artifactId>mvn-sample</artifactId>
  <version>TAG</version>
  <type>aar</type>
</dependency>