Leap CLI Commands

The Leap CLI is a tool for developers. With the help of the CLI, the amount of boilerplate code and configuration is severely decreased. This guide explains the basic actions available in the CLI.

It is Highly Recommended that all Leap Developers use the Leap CLI

Follow the Leap CLI Installation and Setup Guide if you do not already have Leap CLI configured in your development environment.

The purpose of this document is to detail all of the available commands used by the CLI, they can be executed in any order unless the description states otherwise.

Commands

Initialize New Project
Description:
Creates a new Leap Project in the current directory. The root level of the project is created “/attunedlabs”. By default, all of the required framework and feature files – along with their configurations – will be generated within the project with the build profile of “local”.

Command:
leap-cli -init <profile>

Required Parameters:
<profile>, can consist of the values “local”, “test”, “prod”

Optional Parameters:
-configDB, if you wish to initialize the database schema at the same time

Example:
leap-cli -init “prod”
leap-cli -init “local” -configDB “myDBSchema”
Initialize Database
Description:
Creates a new schema in the existing MySQL Database. By default, the schema will be named “leap”. By using the optional -name parameter you can specify your own schema name.

If you use a custom schema name, be sure that the connection string in the globalAppConfig.properties file is also updated.

Command:
leap-cli -configDB

Optional Parameters:
<schema name>, will be “leap” if not provided

Example:
leap-cli -configDB “testing”
Create New Feature
Description:
Creates a new maven project in the “/attunedlabs/services” directory. This command automatically registers the Feature-Installer, BaseRoute, Beans, and creates a sample HTTP Service for testing.

Command:
leap-cli –a <folderName> –g <maven groupId> –fg <featureGroup> –fn <featureName> –impl <implementationName> –ven <vendorName> –p <profile>

Required Parameters:
-artifactId || -a, maven project name
-groupId || -g, maven project group ID
-featureGroup || -fg, feature group name of new feature
-featureName || -fn, feature name of new feature
-implementation || -impl, implementation name of new feature
-vendor || -ven, vendor name of new feature
-profile || -p, profile name(local, prod or test)

Optional Parameters:
-permastore || -perma, adds default Permastore configuration files
-dataContext || -dContext, adds default Leap Data Context configuration files
-eventing || -ev, adds default Eventing configuration files

Example:
leap-cli –a “newProject” –g “com.attunedlabs” –fg “testing” –fn “first” –impl “welcome” –ven “attunedlabs” –p “local” -perma
Add Advanced Configurations to Current Feature
Description:
Modifies an existing Feature to add one or more advanced configurations. Available configurations to add are Eventing, Data Context, and Permastore.

Command:
leap-cli -add <configName>

Parameters:
-add, options are “eventing-config”, “permastore”, “featureDataContext”

Notes:
It’s possible to add more than one with a single command by combining the options into a single comma-separated string. Must be in a feature directory to use this command e.g. “/attunedlabs/services/testFeature/”

Example:
leap-cli -add “permatore, eventing-config”
Add HTTP Service to Existing Feature
Description:
Adds a new HTTP Service (endpoint) to an existing Leap Feature. To use this command, you must be in the directory of the Feature that you’d like to enrich.

e.g. To add “foo” service to “TestBar” Feature the required directory is: “/attunedlabs/services/TestBar

Command:
leap-cli -addservice <serviceName> -httpMethod <METHOD>

Parameters:
-addservice, the name of the new service. This String should not contain spaces or special characters.

-httpMethod, the type of HTTP method to use. Options are: POST, GET, PUT, DELETE, UPDATE

Example:
leap-cli -addservice “foo” -httpMethod “POST”
Build Leap Project
Description:
Completes a Maven build for a specific Feature while inside of the “../services/<feature>” directory.

Executes the maven-build.bat file in the “../services” directory to build the entire Leap project. When executed from the “services” level.

Command:
leap-cli -build <profile>

Required Parameters:
-build, initiates the build process for Leap project or specific Feature, based on the current directory. Accepts “local”, “test”, or “prod” as <profile> values.

Optional Parameters:
-new, when used in the “../services” directory, it will generate a new maven-build.bat file based on all of the Features currently available.

-verb, -verbose, using this parameter with the leap-cli will enable debug-level logging while building the whole leap project. This flag is not supported when building a specific feature.

Notes:
If you have just imported a new Feature or created one manually, it would be a good choice to use the -new parameter to get a fresh


Example:
leap-cli -build “local” -new (services directory)
leap-cli -build “local” -verb (services directory)
leap-cli -build “local” (feature directory)
Run Leap Project
Description:
After building the Leap project, this will run the project using Maven, from the command line. This command can be run from either the /attunedlabs directory or the /attunedlabs/services directory.

Command:
leap-cli -run

Parameters:
-run, run the Feature-Installer and start project.

Example:
leap-cli -run
Import Existing Feature to Current Project
Description:
Registers a copied Feature with the current Leap project. After doing a copy-paste or clone of an already existing Feature it is required to configure the Feature with the Leap Framework for it to work properly.

Import will configure the BaseRoute, Beans, Feature-Installer POM file, and create a configuration directory for the new Feature.

Command:
leap-cli -importFeature <featureName> -execFile <executionFileName> -implFile <implementationFileName>

Parameters:
-importFeature, name of the Feature being imported

-execFile, the name of the execution file for the feature being imported. Only the short name is required if the standard execution file naming convention is followed (featureName-implementationName-feature.xml). If a non-standard execution file is present, you must provide the full file name.

-implFile, the name of the implementation file. Only the short name is required if the standard implementation file naming convention is followed (featureName-implementationName-impl.xml). If a non-standard implementation file name is present, you must provide the full file name.

Example:
leap-cli -importFeature “testFeature” -execFile “myExecutionFileName” -implFile “myImplementationFileName”
Shutdown / Clean-up Leap after Running
Description:
While running the Leap project, there are several companion services such as Hazelcast that start running. When you press CTRL+C to stop Leap from running, it does not stop the companion services. If these services are not stopped, when trying to run Leap again, the process may fail. It’s highly suggested to use this command every time that leap is stopped.

Because of this behavior, it is necessary to manually terminate the companion services. Leap-CLI can do this for you automatically with the -shutdown command. It is usable from the /services directory.

Command:
leap-cli -shutdown

Parameters:
-shutdown, automatically closes companion services such as Hazelcast

Example:
leap-cli -shutdown

Leap Quickstart Guide

Follow the Leap Quickstart Guide to create a practice project to get some hands-on experience with Leap and the Leap CLI.

Updated on November 5, 2021

Was this article helpful?

Related Articles