How to publish the java library into Maven Central Repository

2023-04-07
  1. Create a Sonatype Account and Claim your Namespace by an new issue. Sonatype URL
  2. Create and Publish the PGP Keys
    • Download Gpg4win from https://gpg4win.org/download.html
    • Install and check version by command: gpg –version
    • Create new key pair by gpg –gen-key
    • List keys and find id by gpg –list-keys
    • Send the public key to public server
      gpg –keyserver hkp://keyserver.ubuntu.com:11371 –send-keys
      OR
      gpg –keyserver keyserver.ubuntu.com –send-keys
      
    • Check the server is received
      gpg –keyserver hkp://keyserver.ubuntu.com –recv-keys
      
  3. Signing a File
    gpg -ab xxx.jar
    
  4. Verify Signed file
    gpg –verify xxx.jar.asc
    
  5. Prepare Your Project Maven POM File