We all SAP developers know that SAP Cloud Application Programming Model is rocking these days for developing enterprise grade services and applications. In order to develop the CAPM application, we can choose either Node.js or Java as a language of choice and SAP Business Application Studio (BAS), Visual Studio (VS) Code, or Eclipse as an IDE of choice. SAP Business Application Studio is a Web-based IDE that is preconfigured and ready to start development with no additional configuration tasks whereas VS Code and Eclipse require additional tools to be installed for CAPM Development.
Setting up the VS Code for CAP Node.js Development
First thing first, install Visual Studio Code on your local machine if you haven't already got one. Once you have a successful installation of VS Code, perform the following steps to make VS Code ready for CAP Node.js development. You can skip any step if you already have that tool installed on your machine.
1. Install Node.js
- Download the latest version of Node.js and follow the installer prompts to install it on your machine.
- To verify the installation of Node.js, run command node -v in Command Prompt. It should print the Node.js version. Also, run command npm -v to ensure npm (package manager) is up and running.
2. Install CDS Tools for CAP Development
- Open Command Prompt and run command - npm i -g @Sap/cds-dk
- To verify, run command cds -v in Command Prompt. It should print out installed packages and their versions.
3. Install CF CLI (Command Line Interface) for Cloud Foundry operations such as app deployment, service creation, etc.
- To download the CF CLI installer, visit GitHub repository https://github.com/cloudfoundry/cli
- Go to the README file and then find the Downloads section.
- Select the installation version that you would like to install.
- Download the CF CLI installer for your OS and start installation on your machine.
- After installation, run command cf -v for verification. Please note that You would need to reopen Command Prompt window if it was already open at the time of installation.
- Now install multi apps plugin to enable deployments by running command cf install-plugin multiapps. To verify, run command cf deploy --help. It should print out all the options and usage available for cf deploy command.
4. Install MTA Build Tool (MBT) to build/package a deployment-ready multitarget application
- To install MTA build tool globally, run command npm install -g mbt
- To verify installation, run command mbt -v and it should print out the version info.
- MBT tool requires GNU Make during the build of an application. Ensure you have GNU Make installed on your machine. (If you have Chocolatey installed on your machine, simply run choco install make to install GNU Make)
5. Install Windows Build Tools
- Open Windows PowerShell with the administrator rights and run command npm install --global --production windows-build-tools
6. Required VS Code Extensions
Setting up the VS Code for CAP Java Development
In order to set up the VS Code for CAP Java Development, we will need to perform all the tasks mentioned above for the Node.js development environment including the extensions installation part. In addition to those, the installation of Java JDK and Maven is required. To install Java and Maven, follow the steps given below:
1. Install Java JDK
- Download and install Java JDK 8 or higher if you already haven't got it installed on your machine.
2. Set JAVA_HOME environment variable
- Open Command Prompt with Administrator rights.
- Run command - setx JAVA_HOME -m "C:\Program Files\Java\jdk1.8.0_251". Please change the Java path in quotes as per your Java folder location.
- Now run command - <