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.
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.
The commands below are based on Leap-CLI v1.3. Versions prior to this may not support all of command below.
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”
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 currently selected database. By default, the schema will be named “leap”. Leap CLI will use HSQLDB, but MySQL can be used by specifying the -dbType command while configuring the schema.
Leap CLI will automatically update the connection string in the globalAppDeploymentConfig.properties file.
Note: the database type is maintained for each profile. It is possible to use HSQLDB for local and MySQL for testing/prod profiles.
Command:
leap-cli -configDB <schemaName>
Command Variation:
leap-cli -configDB <schemaName> -dbType <database type>
leap-cli -configDB -p <profile>
Optional Parameters:
<schema name>, will be “leap” if not provided
<databaseName>, “hsql” by default. Supports “hsql” || “mysql”
<profile>, “local” by default. Options are “local”, “test”, “prod”
Example:
leap-cli -configDB “testing”
leap-cli -configDB -dbType “mysql” -p “prod”
Creates a new schema in the currently selected database. By default, the schema will be named “leap”. Leap CLI will use HSQLDB, but MySQL can be used by specifying the -dbType command while configuring the schema.
Leap CLI will automatically update the connection string in the globalAppDeploymentConfig.properties file.
Note: the database type is maintained for each profile. It is possible to use HSQLDB for local and MySQL for testing/prod profiles.
Command:
leap-cli -configDB <schemaName>
Command Variation:
leap-cli -configDB <schemaName> -dbType <database type>
leap-cli -configDB -p <profile>
Optional Parameters:
<schema name>, will be “leap” if not provided
<databaseName>, “hsql” by default. Supports “hsql” || “mysql”
<profile>, “local” by default. Options are “local”, “test”, “prod”
Example:
leap-cli -configDB “testing”
leap-cli -configDB -dbType “mysql” -p “prod”
Create New Feature
Description:
Creates a new Leap project in the “/attunedlabs/services” directory. This command automatically registers the Feature with the Feature-Installer, imports into BaseRoute, Beans, generates default configurations, and creates a sample HTTP Service for testing.
By default, this command generates a project that includes an execution and implementation. To generate an execution and implementation project separately you must use the -provider flag. To generate an implementation project only you must use the -isImpl flag
Command:
leap-cli –a <folderName> –g <maven groupId> –fg <featureGroup> –fn <featureName> –impl <implementationName> –ven <vendorName>
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 Leap Data Context configuration files
-eventing || -ev, adds default Eventing configuration files
-isImpl, generates only an implementation project
-provider, generates exec and impl projects in separate directories
Example:
leap-cli –a “newProject” –g “com.attunedlabs” –fg “testing” –fn “first” –impl “welcome” –ven “attunedlabs” –p “local” -perma
leap-cli -a “newProject” -g “com.attunedlabs” -fg “testing” -fn “first” -impl “welcome” -ven “attunedlabs” -provider “default”
Creates a new Leap project in the “/attunedlabs/services” directory. This command automatically registers the Feature with the Feature-Installer, imports into BaseRoute, Beans, generates default configurations, and creates a sample HTTP Service for testing.
By default, this command generates a project that includes an execution and implementation. To generate an execution and implementation project separately you must use the -provider flag. To generate an implementation project only you must use the -isImpl flag
Command:
leap-cli –a <folderName> –g <maven groupId> –fg <featureGroup> –fn <featureName> –impl <implementationName> –ven <vendorName>
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 Leap Data Context configuration files
-eventing || -ev, adds default Eventing configuration files
-isImpl, generates only an implementation project
-provider, generates exec and impl projects in separate directories
Example:
leap-cli –a “newProject” –g “com.attunedlabs” –fg “testing” –fn “first” –impl “welcome” –ven “attunedlabs” –p “local” -perma
leap-cli -a “newProject” -g “com.attunedlabs” -fg “testing” -fn “first” -impl “welcome” -ven “attunedlabs” -provider “default”
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.
This command must be called from within a Leap Project. e.g. “/attunedlabs/services/<myFeature>”.
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”
leap-cli -add “featureDataContext”
Modifies an existing Feature to add one or more advanced configurations. Available configurations to add are Eventing, Data Context, and Permastore.
This command must be called from within a Leap Project. e.g. “/attunedlabs/services/<myFeature>”.
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”
leap-cli -add “featureDataContext”
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”
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 specific directory)
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 specific 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.
A new CMD will be opened to show the logs. Exit the Leap application with CTRL+C from the new CMD or use the -shutdown command.
Command:
leap-cli -run
Parameters:
-run, run the Feature-Installer and start project.
Example:
leap-cli -run
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.
A new CMD will be opened to show the logs. Exit the Leap application with CTRL+C from the new CMD or use the -shutdown command.
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 into your /services directory 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. If you use the -importLocation flag, you do not need to copy a feature into your current project before importing. See examples.
For execFile and implFile, the file names must end with “-exec.xml” and “-impl.xml” respectively.
Command:
leap-cli -importFeatures <featureName> -execFile <executionFileName> -implFile <implementationFileName> -execProject <projectDirectory>
Parameters:
-importFeatures, one or more feature names can be specified as comma separated values. Usually same as execProject name.
-execFile, the name of the execution file for the feature being imported.
-implFile, the name of the implementation file.
-execProject, the name of the project in the /services/ directory that belongs to the execution project.
-importLocation, absolute path to the Leap project the feature is being imported from. ../attunedlabs
Example:
leap-cli -importFeatures “testFeature” -execFile “myExecutionFileName” -implFile “myImplementationFileName”
leap-cli -importFeatures “testFeature” -importLocation “C:\leap\myProject”
Registers a copied Feature with the current Leap project. After doing a copy-paste or clone of an already existing Feature into your /services directory 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. If you use the -importLocation flag, you do not need to copy a feature into your current project before importing. See examples.
For execFile and implFile, the file names must end with “-exec.xml” and “-impl.xml” respectively.
Command:
leap-cli -importFeatures <featureName> -execFile <executionFileName> -implFile <implementationFileName> -execProject <projectDirectory>
Parameters:
-importFeatures, one or more feature names can be specified as comma separated values. Usually same as execProject name.
-execFile, the name of the execution file for the feature being imported.
-implFile, the name of the implementation file.
-execProject, the name of the project in the /services/ directory that belongs to the execution project.
-importLocation, absolute path to the Leap project the feature is being imported from. ../attunedlabs
Example:
leap-cli -importFeatures “testFeature” -execFile “myExecutionFileName” -implFile “myImplementationFileName”
leap-cli -importFeatures “testFeature” -importLocation “C:\leap\myProject”
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
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
Start and Stop Database
Description:
For many CLI commands an active database connection is required. This is usually MySQL or HSQLDB.
The database can be started using -startDB and stopped using -shutDB commands.
Note: When using HSQLDB it is REQUIRED that you close the database connection before trying to interact with a new project.
Command:
leap-cli -startDB
leap-cli -shutDB
Command Variation:
leap-cli -startDB -p <profile>
Optional Parameters:
<profile>, “local” by default. Options are “local”, “test”, “prod”
Examples:
leap-cli -shutDB
leap-cli -startDB -p “local”
For many CLI commands an active database connection is required. This is usually MySQL or HSQLDB.
The database can be started using -startDB and stopped using -shutDB commands.
Note: When using HSQLDB it is REQUIRED that you close the database connection before trying to interact with a new project.
Command:
leap-cli -startDB
leap-cli -shutDB
Command Variation:
leap-cli -startDB -p <profile>
Optional Parameters:
<profile>, “local” by default. Options are “local”, “test”, “prod”
Examples:
leap-cli -shutDB
leap-cli -startDB -p “local”
Check Server Status
Description:
Leap projects utilize a number of different ports during development. Consider the following pieces that might allocate a port:
Leap (9060, 9050, 9090,…)
Hazelcast (5701, 5702,…)
HSQLDB (9001)
MySQL (3306)
This command allows you to quickly check if a port is currently being used. Most often it is used to verify if HSQLDB is connected, Hazelcast is stopped, or check a Leap standard port.
Command:
leap-cli -serverStatus -port <portNumber>
Parameters:
<portNumber>, the port to check
Example:
leap-cli -serverStatus -port 9001
Leap projects utilize a number of different ports during development. Consider the following pieces that might allocate a port:
Leap (9060, 9050, 9090,…)
Hazelcast (5701, 5702,…)
HSQLDB (9001)
MySQL (3306)
This command allows you to quickly check if a port is currently being used. Most often it is used to verify if HSQLDB is connected, Hazelcast is stopped, or check a Leap standard port.
Command:
leap-cli -serverStatus -port <portNumber>
Parameters:
<portNumber>, the port to check
Example:
leap-cli -serverStatus -port 9001
Print Leap Version Information
Description:
In order to verify the Leap-CLI details, the -version command prints all of the required details.
Java Version, Leap Version, Maven Version, Leap CLI Home, Java Home, Maven Home.
Command:
leap-cli -version
Example:
leap-cli -v
leap-cli -version
In order to verify the Leap-CLI details, the -version command prints all of the required details.
Java Version, Leap Version, Maven Version, Leap CLI Home, Java Home, Maven Home.
Command:
leap-cli -version
Example:
leap-cli -v
leap-cli -version
Generate a Leap Release (Uber JAR)
Description:
Once you are ready to build your entire leap project into a single executable unit, use the -release command. This command bundles the entire project and all of the dependencies into a single executable JAR file – often referred to UberJAR or FatJAR.
By providing the <platform> parameter, specific build steps are taken into account for the mentioned platform. For Windows, this generates a .bat file that executes the JAR.
Command:
leap-cli -release <platform>
Parameters:
<platform>, the targeted operating system for deployment. “windows” or “linux”
Example:
leap-cli -release “windows”
Once you are ready to build your entire leap project into a single executable unit, use the -release command. This command bundles the entire project and all of the dependencies into a single executable JAR file – often referred to UberJAR or FatJAR.
By providing the <platform> parameter, specific build steps are taken into account for the mentioned platform. For Windows, this generates a .bat file that executes the JAR.
Command:
leap-cli -release <platform>
Parameters:
<platform>, the targeted operating system for deployment. “windows” or “linux”
Example:
leap-cli -release “windows”
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.