SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
⤢ Open full site

Create a Hello World Multitarget Application

This tutorial will help you create a module that describes a Java application, a resource that describes your database binding and additional metadata required for the deployment.

Overview

🎓 beginner 20 min. SAP Business Technology PlatformBeginnerJava

You will learn

  • How to create a module that describes a Java application
  • How to create a resource that describes your database binding
  • How to create additional metadata required for the deployment
Unknown U Unknown March 8, 2024
Created by October 17, 2022
Contributors

Prerequisites

Prerequisites

  • You have created a Java application .war file.
  • You have an SAP BTP database configured in your subaccount and valid credentials.

Steps

Step 1 Modeling the MTA deployment descriptor

You define the entities that have to be deployed, namely modules and resources related to other modules, in the MTA deployment descriptor. This is a YAML file that defines the contract between you as a deployable artifact provider and the SAP BTP as a deployer tool. Initially, you have to describe the metadata required for the deployment.

  1. Create an empty text file and name it mtad.yaml.

  2. Using a text editor, enter the following data in the file:

    YAML
    _schema-version: '3.1'
    
    parameters:
        hcp-deployer-version: '1.1.0'
    
    ID: com.example.demo.basic
    version: 0.1.0

    Strictly adhere to the correct indentations when working with YAML files, and do not use the tabulator character.

    The example above instructs the SAP BTP to:

    • Validate the Multitarget Application against the MTA specification version 3.1
    • Use deploy features specific to the SAP BTP marked as version 1.0
    • Deploy the Multitarget Application as a Solution with ID com.example.demo.basic
    • Consider the Multitarget Application version as a version 0.1.0
  3. Create the module that describes the Java application. In the mtad.yaml, add the following data:

    YAML
    modules:
        -name: example-java-app
         type: com.sap.java
         requires:
           - name: db-binding
         parameters:
           name: example
           jvm-arguments: -server
           java-version: JRE 7
           runtime: neo-java-web
           runtime-version: 1

    The example above instructs the SAP BTP to:

    • Deploy a Java application with a specific runtime, Java version, and runtime arguments
    • Require a MTA resource called db-bindings, where you describe your binding data
  4. Describe the database binding ID and the database credentials the Java application has to use by adding the following to the mtad.yaml:

    YAML
    resources:
      - name: db-binding
        type: com.sap.hcp.persistence
        parameters:
          id:

    The example above instructs the SAP BTP to create a database binding during the deployment process.

    At this point of the procedure, no database ID or credentials for your database binding have been added. The reason for this is that all the content of the mtad.yaml so far is a target-platform independent, meaning that the same mtad.yaml could be deployed to multiple SAP BTP subaccounts.

    The information about your database ID and credentials are, however, subaccount-specific. To keep the mtad.yaml target platform independent, you have to create an MTA extension descriptor. This file is used in addition to your primary descriptor file, and contains data that is account-specific.

    Security-sensitive data, for example database credentials, should be always deployed using an MTA extension descriptor, so that this data is encrypted.

Step 2 Create the MTA extension descriptor
+
Step 3 Packaging your Multitarget Application
+
Step 4 Create your Multitarget Application archive
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 4
1. Modeling the MTA deployment descriptor 2. Create the MTA extension descriptor 3. Packaging your Multitarget Application 4. Create your Multitarget Application archive

Learn more →