CLI Commands

The “ballerina” command is your one-stop-shop for all the things you do in Ballerina. You can use it in the below format.

ballerina <THE-COMMAND> <ITS-ARGUEMENTS>

The below are all the actions you can perform with it:

Get started

These commands help you check your installation and know that things are set up smoothly.

version Tells you the version of Ballerina you have installed.
home Prints out the location of your current Ballerina distribution. This is useful if you need to help your IDE plugin to figure out where Ballerina is.

Build, test, and run programs

These everyday commands are your best friends! They address the very basics of programming in Ballerina such as compiling, running, testing programs, and generating their documentation.

build Compile a Ballerina program, a single BAL file, an entire project, or a single root module into an executable JAR file.
test Run tests of a particular module or all the modules of a Ballerina project. For more information, see How to Test Ballerina Code.
run Build and run a Ballerina program, a single BAL file, an entire project, or a previously-built program. For more information, see How to Run Ballerina Programs.
clean Clean all artifacts generated by the build command for a project.
doc Generate API documents for all public symbols of a Ballerina module or project. For more information, see How to Document Ballerina Code.
format Format Ballerina source files as per the Ballerina Style Guide.

Work with Ballerina Central

Ballerina Central is how you share Ballerina modules with others in a safe, secure, and dependable way.

search Search Ballerina Central for modules.
pull Pull a module from Ballerina Central.
push Upload a module to Ballerina Central. For more information, see How to Publish a Module.

Manage projects

Ballerina projects are the way to organize real world Ballerina development tasks.

new Create a Ballerina project. For more information, see How to Structure Ballerina Code.

Use the supporting tools

These powerful supporting tools extend Ballerina to various ecosystem technologies that are inherently cloud-native. This functionality will grow over time and will even be developer extensible in the future.

encrypt Use this tool to encrypt sensitive data and pass them to a Ballerina program via the configuration system.
openapi This is the OpenAPI (Swagger) stub/skeleton generation tool. For more information, see Ballerina OpenAPI Tools.
grpc This is the gRPC stub/skeleton generation tool. For more information, see How to generate Ballerina code for Protocol Buffer Definition.