Home > Uncategorized > Publishing to Maven Central

Publishing to Maven Central

You can follow the tutorial for publishing your library from this following series of youtube videos. You will need to request via Sonatype JIRA and wait for approval. It’s explained in the series.

However if you want the easiest way you can leverage using bitbucket pipeline. You can see the step by step on how to do that from this tutorial. It’s still in beta phase but looks promising. You should give it a try and ask for the trial. Yes, you need to request the trial first and wait for the approval.

The missing part on the tutorial above is on how to generate the key. Here’s how you can do that in Windows machine.

  1. Download the gnugpg for windows here
  2. Setup the key for signing
    1. Generate the key
      gpg –gen-key
    2. Find the list of the key to find the id
      gpg2 –list-keys
      gpg2 –list-secret-keys

      Let’s say that the id is 4C7CF393. We will use this key in the subsequent step.

    3. Publish the public key
      gpg2 –keyserver hkp://pool.sks-keyservers.net –send-keys 4C7CF393
    4. Export the private key
      gpg -a –export-secret-key 4C7CF393 > private-key.gpg
    5. Donlot http://gnuwin32.sourceforge.net/packages/openssl.htm for encryption
    6. Add the binaries to your PATH environment variables
    7. Encrypt the key
      openssl aes-256-cbc -in private-key.gpg -out private-key.gpg.enc -pass pass:somesecretpwd
  3. Upload that key to your repository. You can base your repository by copying this repository and replacing the private key there.
  4. Copy your source code and etc there.
  5. Replace the configuration for username and password by looking at README from this repository
  6. Edit the pom.xml so it publish your library
  7. You can follow the rest of the tutorial from this

Happy Publishing !

Cheers

Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: