cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with mbt build in Newly Created CAP Project on SAP BTP Trial

BhanuKiran1
Discoverer
0 Kudos
198

I have created a CAP Project in SAP Business Application Studio (BAS) using the following steps:

  1. FileNew Project From TemplateCAP Project
  2. Provided:
    • Project Name: sample
    • Runtime: Node.js
    • Database: PostgreSQL
    • Deployment Type: Cloud Foundry (MTA Deployment)
    • Runtime Capability: SAP BTP Authorization and Trust Management Service
    • Sample Content: Minimal Sample

The project was successfully created and was functioning as expected when running locally.

However, when attempting to execute mbt build to package the project for deployment, the following error occurs:
[2025-02-05 06:23:23] INFO validating the MTA project
[2025-02-05 06:23:23] ERROR the "mta.yaml" file is not valid:
line 33: the "gen/pg" path of the "sample-postgres-deployer" module does not exist
make: *** [Makefile_20250205062318.mta:46: validate] Error 1
Error: could not build the MTA project: could not execute the "make -f Makefile_20250205062318.mta p=cf mtar= strict=true mode=" command: exit status 2.


Notably, mbt build works fine for my other existing projects. The issue seems to be specific to this newly created project.
I would appreciate any insights into the root cause of this issue and any recommended resolution steps.
Thank you for your support.



Accepted Solutions (0)

Answers (1)

Answers (1)

MioYasutake
Active Contributor
0 Kudos

@BhanuKiran1 

Add the following command to mta.yaml. It will generate the gen/db folder.

build-parameters:
  before-all:
    - builder: custom
      commands:
        - npx cds build --production  

 

BhanuKiran1
Discoverer
0 Kudos

Thank you for your reply. It was already added in the mta.yaml.

MioYasutake
Active Contributor
0 Kudos
@BhanuKiran1 Is the gen/db folder created when you execute the `cds build --production` command?
BhanuKiran1
Discoverer
0 Kudos

I tried executing that command. Still the folder is not getting created.
Giving the following logs when executed,

user: llcapm $ cds build --production
building project [/home/user/projects/llcapm], clean [true]
cds-dk [8.6.1], cds [8.7.1], compiler [5.7.4], home [/home/user/projects/llcapm/node_modules/@sap/cds]

{
build: {
target: 'gen',
tasks: [
{ for: 'nodejs', src: 'srv', options: { model: ['db', 'srv', 'app'] }}
]
}
}

done > wrote output to:
gen/srv/package-lock.json
gen/srv/package.json
gen/srv/srv/csn.json
gen/srv/srv/odata/v4/CatalogService.xml

build completed in 180 ms