SAP_Paas
SAP BTP Cloud Foundry(Paas 平台及服务)
-
使用 MTA 部署到 Cloud Foundry环境中
-
不同方法在Cloud Foudry创建和部署MTA 应用程序
-
Cloud MTA构建工具,之后在使用Cloud Foundry CLI:mbt
- **Doc:**mta.yaml:develop descriptor: used to generate the development descriptor mtad.yaml which is required for deploying an MTA to the target runtime.
- Doc::if use comman-lines to deploy an MTA,don’t need an mta.yaml,but have to manually create the mtad.yaml file.
-
mbt :Cloud MTA Build Tool
-
Introduction
-
The Cloud MTA Build Tool is a standalone command-line tool that builds a deployment-ready multitarget application (MTA) archive
.mtar
file from the artifacts of an MTA project according to the project’s MTA development descriptor (mta.yaml
file), or from the module build artifacts according to the MTA deployment descriptor (mtad.yaml
file).The archive builder is used on a file system that is independent from the development environment where the application project was created.
The archive builder is supported on Windows and Linux operating systems.
for more info:Cloud MTA Build Tool (sap.github.io)
-
-
-
How to Install
-
download:
- Download the latest binary file according to your operating system.
wget https://github.com/SAP/cloud-mta-build-tool/releases/download/<LATEST>/cloud-mta-build-tool_<LATEST>_Linux_amd64.tar.gz
- Extract the archive file to the folder where you want to install the tool.
//Example for Darwin/Linux:
tar xvzf cloud-mta-build-tool_LATEST_Linux_amd64.tar.gz- Add the binary file to your
~/bin
path according to your operating system(也可直接添加path)- In Darwin / Linux, copy the binary file to the
~/usr/local/bin/
folder, for example:cp mbt /usr/local/bin/
- In Windows, copy the
mbt.exe
binary file to theC:/Windows/
folder.
- In Darwin / Linux, copy the binary file to the
-
Install npm
- Using npm to install mbt
npm install -g mbt
-
Make
-
Windows
-
in order to build an MTA archive from a project’s source code in a Windows environment, install
GNU Make 4.2.1
on your machine.You can download the executable from a source that you trust according to your processor (32-bit or 64-bit) to a local folder (change the file name to
make.exe
) and then add the folder to thePATH
environment variable. For example, you can download the tool from here.Alternatively, you can use Chocolatey to install or upgrade
GNU Make
.
-
-
Mac
- If the build fails because
make
cannot run, you might have to install the Command-Line Tools. See the troubleshooting topic for more details
- If the build fails because
-
-
-
Usage:more cli :[Usage - Cloud MTA Build Tool (sap.github.io)](https://sap.github.io/cloud-mta-build-tool/usage/
-
build an MTA archive from project resource
-
Both methods leverage the
GNU Make
technology for the actual build.-
One step
mbt build
mbt build flags:
Flag Mandatory / Optional Description Examples -p (--platform)
Optional The name of the target deployment platform. The supported deployment platforms are:’ cf
for SAP Cloud Platform, Cloud Foundry environmentneo
for the SAP Cloud Platform, Neo environmentxsa
for the SAP HANA XS advanced model If this parameter is not provided, the project is built for the SAP Cloud Platform, Cloud Foundry environmentmbt build -p=cf
-s (--source)
Optional The path to the MTA project; the current path is set as the default. mbt build -p=cf -s=C:/TestProject
-t (--target)
Optional The folder for the generated MTAR
file. If this parameter is not provided, theMTAR
file is saved in themta_archives
subfolder of the current folder. If the parameter is provided, theMTAR
file is saved in the root of the folder provided by the argument.mbt build -p=cf -t=C:/TestProject
--mtar
Optional The file name of the generated archive file. If this parameter is omitted, the file name is created according to the following naming convention: <mta_application_ID>_<mta_application_version>.mtar
If the parameter is provided, but does not include an extension, the.mtar
extension is added.mbt build -p=cf --mtar=TestProject.mtar
-e (--extensions)
Optional The path or paths to multitarget application extension files (.mtaext). Several extension files separated by commas can be passed with a single flag, or each extension file can be specified with its own flag. mbt build -e=test1.mtaext,test2.mtaext
ormbt build -e=test1.mtaext -e=test2.mtaext
--strict
Optional The default value is true
. If set totrue
, the duplicated fields and fields that are not defined in themta.yaml
schema are reported as errors. If set tofalse
, they are reported as warnings.mbt build -p=cf --strict=true
BETA -m (--mode)
Optional The possible value is verbose
. If run with this option, the temporaryMakefile
is generated in a way that allows the parallel execution ofMake
jobs to make the build process faster.mbt build -m=verbose
BETA -j (--jobs)
Optional Used only with the --mode
parameter. This option configures the number ofMake
jobs that can run simultaneously. If omitted or if the value is less than or equal to zero, the number of jobs is defined by the number of available CPUs (maximum 8).mbt build -m=verbose -j=8
-
Two step
mbt init
make
-
-
-
Configuration
-
Configuer a builder for a specific model
Doc:Optionally, you can define the builder behavior by configuring the parameters in the
build-parameters
section in themta.yaml
file for each module or globally.(通过编写mta.yaml配置文件中的build-parameters参数 自定义使用的builder以及相关的行为,支持的builder 有: Builders Execution Commands.)
Doc:Default builder for some specific model, if the name of the builder are not explicitly set:Modules’ default builder configuration.
(未指定特定builder,module默认的builder:Modules’ default builder configuration.)
example:
- name: module1
type: java
build-parameters:
builder: zip -
Configue build oder
Doc:To define the build order of modules, in the
mta.yaml
file, add arequires
section under thebuild-parameters
section of the dependent module; that is, a module that should be built only after building another required module. Then specify the required module name as a property of the dependent module’srequires
section.(通过在 mta文件中 build-parameters 参数下添加 requires 小节指定所需的module名字指定build 顺序的顺序,即该module需要被指定的modue构建的结果才能进行构建)
注:顺序不重要,只要指明了requires,并且不支持循环依赖,会导致构建出错(**NOTE:**The order of modules in the
mta.yaml
file is not important as long as therequires
sections have been coded with the relevant dependencies.CAUTION: Cyclical dependencies are not allowed. If such dependencies are found, the build fails.)example:
ID: myproject
_schema-version: '3.1'
version: 0.0.1
modules:
- name: A
type: html5
path: pathtomoduleA
build-parameters:
requires:
- name: B
- name: B
type: html5
path: pathtomoduleB- result of B to build A:
ID: myproject
_schema-version: '3.1'
version: 0.0.1
modules:
- name: A
type: html5
path: pathtomoduleA
build-parameters:
requires:
- name: B
artifacts: ["*"]
target-path: "newfolder"
- name: B
type: html5
path: pathtomoduleB
-
-
-