Skip to main content
Version: 5.1

CLI Commands

The bal command line tool builds, runs, tests, and generates code for integration projects. This page lists the commands used across the WSO2 Integrator documentation, with the flags shown in the guides. Run a command with --help for its full option list.

Build and run​

CommandDescription
bal buildCompile the project into an executable.
bal build --graalvmBuild a GraalVM native executable. See GraalVM native images.
bal build --cloud=<target>Generate deployment artifacts. Targets used in the docs: docker, k8s, openshift, aws_lambda, azure_functions. See Cloud.toml reference and Containerized deployment.
bal runBuild and run the project. Pass configurable values after --, for example bal run -- -Cport=9090.
bal run --debug <port> <path>Run with a remote debugger attached to the given port. See Debug Your Integration.
bal new <name> -t libCreate a new project from a template, here a library.
bal profileProfile the running integration. See Profiling.

Test​

See Test for the guides.

CommandDescription
bal testRun the project's tests.
bal test --tests <name>Run specific tests, for example --tests testDiscountCalculation#"half-price" for one data set.
bal test --groups <g1>,<g2> / --disable-groups <g> / --list-groupsSelect, exclude, or list test groups.
bal test --parallelRun tests in parallel.
bal test --rerun-failedRe-run only the tests that failed.
bal test --code-coverage --min-coverage=<n>Collect coverage and fail below a minimum percentage.
bal test --test-reportGenerate a test report.
bal test --graalvmRun tests on a native image.
bal test --debug <port> <path>Run tests with a remote debugger attached.
bal test -C<name>=<value>Override a configurable variable, for example -CdbPort=5432.

Static analysis​

bal scan analyzes your code. See the Scan tool.

CommandDescription
bal scan [<integration>|<source-file>]Analyze a project or a source file.
bal scan --list-rulesList the available rules.
bal scan --include-rules=<rules> / --exclude-rules=<rules>Run only, or skip, the listed rules.
bal scan --format=sarifWrite results in SARIF format.
bal scan --platforms=<list>Report to external platforms such as sonarqube, semgrep, or codeql.
bal scan --scan-reportGenerate a scan report.
bal scan --target-dir=<path>Choose the output directory.

Code generation tools​

Install a tool with bal tool pull <name> and list installed tools with bal tool list. See Developer tools.

CommandDescriptionGuide
bal openapi -i <spec> --mode serviceGenerate an HTTP service or client from an OpenAPI specification.OpenAPI tool
bal graphql -i <schema> --mode serviceGenerate a GraphQL service or client from a schema.GraphQL tool
bal grpc --input <file.proto> --mode service --output .Generate gRPC code from a Protocol Buffers definition.gRPC tool
bal asyncapi -i <spec> --mode serviceGenerate event-driven services from an AsyncAPI specification.AsyncAPI tool
bal wsdl -i <file.wsdl>Generate client code from a WSDL.WSDL tool
bal xsd -i <file.xsd>Generate record types from an XSD.XSD tool
bal edi codegen, libgen, convertX12Schema, convertEdifactSchema, convertESLGenerate code from EDI schemas and convert X12, EDIFACT, and ESL schemas.EDI tool
bal health fhir / bal health hl7Generate types from FHIR implementation guides or HL7v2 definitions.Health tool
bal connector openapi -i <spec>Generate a connector from an OpenAPI specification.Connector tool
bal persist init / add / generate / pull / push / migrateModel data and generate persistence code. Use --datastore <name>, for example mysql.Persist tool

Migration​

CommandDescription
bal migrate-mule <source> [-o <dir>] [-f <3|4>] [-k] [-v] [-d] [-m]Migrate a MuleSoft project.
bal migrate-tibco <source> [-o <dir>] [-k] [-v] [-d] [-m] [-g <org>] [-p <project>]Migrate a TIBCO BusinessWorks project.
bal migrate-logicapps <source> [-o <dir>] [-v] [-m]Migrate Azure Logic Apps workflows.

Common flags: -o output directory, -v verbose, -m treat each child directory (or JSON file) as a separate project, -d dry run (report only), -k keep the source project structure. See Migrate for what each supports.