Create an SAPUI5 App from the Command Line
- How to scaffold an SAPUI5 project
- How to leverage the ui5-tooling to test the app locally
- How to build a multi-target application archive archive
- How to deploy a SAPUI5 web-app to SAP BTP, Cloud Foundry environment
- Install at least version 3.0.0 of the easy-ui5 generator
- Step 1
Run the following command to trigger the creation of a new project.
yo easy-ui5 project
Choose the following responses for the prompted parameters.
Parameter Value What do you want to do?
Create a new OpenUI5/SAPUI5 project [app]
How do you want to name this project?
Which namespace do you want to use?
On which platform would you like to host the application
Application Router @ Cloud Foundry
Which view type do you want to use?
Where should your UI5 libs be served from?
Content delivery network (SAPUI5)
Would you like to create a new directory for the project?
The following installation of the project’s dependencies might take a while.
- Step 2
Let’s have a look at the generated code. Go to the newly created directory and open the code with your favorite editor (here Visual Studio Code).BashCopy
cd com.myorg.myUI5App/ code .
You can see that the wizard created a bunch of folders and files.
The main code for the SAPUI5 app can be found in the directory
webapp. You might miss the folders
mta_archivesas they will be created later during the build step.
package.jsonfile contains many useful information about the project. The
npm scriptsare especially interesting, since they wrap the command we’ll use later.
- Step 3
This project leverages the UI5 tooling framework for development. Among other tasks, this tool belt can help you to start a local web server when you runBashCopy
- Step 4
npm run build:mta
What's the name of the generated archive (You can find this info in the output of the build command or in the mta_archives folder)?
- Step 5
Next, we deploy the generated archive to SAP BTP, Cloud Foundry environment. Trigger the deployment and track the deployment progress in the terminal with the following command.BashCopy
cf deploy mta_archives/myUI5App_0.0.1.mtar
npm run deploywill do both, generate and deploy the application to Cloud Foundry.
- Step 6
You can check the status of all running apps in Cloud Foundry withBashCopy
requested stateof your application should read
You can also check out the logs of your app via
cf logs <app name>
- Step 7
You can see the URL of your application in the output of the previously executed
Open the URL in the browser to see your app in action:
Congrats, you just deployed your first SAPUI5 app from the command line!