Tuesday, June 26, 2018

Publishing a package to Ballerina Central in simple steps

Ballerina is a programming language for integrations. Visit https://ballerina.io/ for more info. Ballerina allows developers to publish their own packages to Ballerina Central, so that others can discover and reuse. The beauty of  open source!!

Here is how to get your own package into the central in simple steps.


  1. Go to the Ballerina Central and signup. You need the token that is given after registering in order to push packages.
  2. Create a new folder(project home) in your machine and run ballerina init command inside the folder. I assume you already have the ballerina installed. This will create your basic project structure.
  3. Create a folder  with the package name you want and write your ballerina code in that.
  4. Create a file called Ballerina.toml in the project home directory. It's content should be something like below,
  5. Then add a Package.md file with content describing your package to be displayed in the central dashboard.
  6. Now run the command, ballerina build package_name to build your package.
  7. Then run the command, ballerina install package_name to import the package to your local ballerina repo.
  8. Finally run the command, ballerina push package_name to push your package to central. For the first time it will only update the token you generated, you will have to rerun the command.
Holla, you are done with publishing your package. Go on and check it out in the https://central.ballerina.io/.

Source - https://ballerina.io/learn/how-to-extend-ballerina/index.html