/
Building and Running CDAP Applications

Building and Running CDAP Applications

In the examples, we refer to the CDAP Sandbox as CDAP, and the example code that is running on it as an application. We'll assume that you are running your application in the default namespace; if not, you will need to adjust commands accordingly. For example, in a URL such as:

http://localhost:11015/v3/namespaces/default/apps...

to use the namespace my_namespace, you would replace default with my_namespace:

http://localhost:11015/v3/namespaces/my_namespace/apps...

Accessing CLI, curl, and the CDAP Sandbox bin

  • For brevity in the commands given below, we will simply use cdap cli for the CDAP Command Line Interface. Substitute the actual path of ./<CDAP-HOME>/bin/cdap cli, or <CDAP-HOME>\bin\cdap.bat cli on Windows, as appropriate.

  • A Windows-version of the application curl is included in the CDAP Sandbox as libexec\bin\curl.exe; use it as a substitute for curl in examples.

  • If you add the CDAP Sandbox bin directory to your path, you can simplify the commands. From within the <CDAP-HOME> directory, enter:

$ cdap cli export PATH=${PATH}:`pwd`/bin

The Windows path has been augmented with a directory where the CDAP Sandbox includes Windows-versions of commands such as curl.

Note: There is an issue with running Microsoft Windows and using the CDAP Local Sandbox scripts when CDAP_HOME is defined as a path with spaces in it. Until this is addressed, do not use a path with space characters in it for CDAP_HOME.

Building an Example Application Artifact

From the example's project root (such as examples/<example-dir>), build an example with the Apache Maven command:

To build without running tests, use:

To build all the examples, switch to the main examples directory and run the Maven command:

Starting CDAP

Before running an example application, check that an instance of CDAP is running and available; if not, follow the instructions for Starting and Stopping CDAP Sandbox.

If you can reach the CDAP UI through a browser at http://localhost:11011/, CDAP is running.

Deploying an Application

Once CDAP is started, there are multiple ways to deploy an application using an example JAR:

The CLI can be accessed under Windows using the bin\cdap.bat cli script.

  • Using an application such as curl (a Windows-version is included in the CDAP Sandbox in libexec\bin\curl.exe):