Gen folder is deleted from after switching to ODATA generator using EDMX
Issue Description
We are trying to use the ODATA generator plug in instead of the com.sap.cloud.sdk.s4hana.datamodel.odata.namespaces.commercialproject format. But during mvn clean install, in the gen folder which is compiled in the srv/src folder, c4p folder containing the messageKeys is deleted and replaced with vdm folder. the expectation is that these folders should co-exists. Because of which we are facing issues during compilation
Important information:
- Your code : https://github.tools.sap/Cloud4RM/Assignment/blob/dev/CAPUpgrade3.0/srv/pom.xml#L173
- Expected outcome : the folders should co-exist
- Actual outcome - the c4p folder is deleted by the vdm plugin
- Steps attempted to resolve the issue
- In case of issues with any of our VDMs: What is causing the custom folder specific for our project to place the messageKeys to be deleted because of the introduction of the plugin for the data generator?
Impact / Priority
We need to resolve these issues ASAP as this is a crucial step for the CAP 3.0 upgrade preparation which is targetted for 2409 release.Affected development phase: e.g. Development
Impact: e.g. Blocked
Timeline: e.g. code merge in 1 week
Error Message
: Compilation failure: [ERROR] /C:/C4PRM_Repository/Repositories/Repository_For_Development/Resource-Management/Assignment/srv/src/main/java/com/sap/c4p/rm/assignment/utils/AssignmentUtility.java:[25,37] package com.sap.c4p.rm.assignment.gen does not exist [ERROR] /C:/C4PRM_Repository/Repositories/Repository_For_Development/Resource-Management/Assignment/srv/src/main/java/com/sap/c4p/rm/assignment/handlers/AssignmentAPIServiceHandler.java:[43,37] package com.sap.c4p.rm.assignment.gen does not exist [ERROR] /C:/C4PRM_Repository/Repositories/Repository_For_Development/Resource-Management/Assignment/srv/src/main/java/com/sap/c4p/rm/assignment/validation/AssignmentDraftsValidator.java:[23,37] package com.sap.c4p.rm.assignment.gen does not exist [ERROR] /C:/C4PRM_Repository/Repositories/Repository_For_Development/Resource-Management/Assignment/srv/src/main/java/com/sap/c4p/rm/assignment/validation/AssignmentValidator.java:[32,37] package com.sap.c4p.rm.assignment.gen does not exist [ERROR] /C:/C4PRM_Repository/Repositories/Repository_For_Development/Resource-Management/Assignment/srv/src/main/java/com/sap/c4p/rm/assignment/utils/AssignmentDraftsUtility.java:[39,37] package com.sap.c4p.rm.assignment.gen does not exist [ERROR] /C:/C4PRM_Repository/Repositories/Repository_For_Development/Resource-Management/Assignment/srv/src/main/java/com/sap/c4p/rm/assignment/integration/UpdateSupplyCommand.java:[24,37] package com.sap.c4p.rm.assignment.gen does not exist [ERROR] /C:/C4PRM_Repository/Repositories/Repository_For_Development/Resource-Management/Assignment/srv/src/main/java/com/sap/c4p/rm/assignment/utils/AssignmentStatusValidationUtility.java:[12,37] package com.sap.c4p.rm.assignment.gen does not exist [ERROR] /C:/C4PRM_Repository/Repositories/Repository_For_Development/Resource-Management/Assignment/srv/src/main/java/com/sap/c4p/rm/assignment/handlers/CapacityGridServiceHandler.java:[59,37] package com.sap.c4p.rm.assignment.gen does not exist [ERROR] /C:/C4PRM_Repository/Repositories/Repository_For_Development/Resource-Management/Assignment/srv/src/main/java/com/sap/c4p/rm/assignment/validation/ValidatorFactory.java:[9,37] package com.sap.c4p.rm.assignment.gen does not exist [ERROR] /C:/C4PRM_Repository/Repositories/Repository_For_Development/Resource-Management/Assignment/srv/src/main/java/com/sap/c4p/rm/assignment/validation/CreateAssignmentForRequestedEffortDistributionValidator.java:[18,37] package com.sap.c4p.rm.assignment.gen does not exist [ERROR] /C:/C4PRM_Repository/Repositories/Repository_For_Development/Resource-Management/Assignment/srv/src/main/java/com/sap/c4p/rm/assignment/validation/CreateAssignmentValidator.java:[22,37] package com.sap.c4p.rm.assignment.gen does not exist [ERROR] /C:/C4PRM_Repository/Repositories/Repository_For_Development/Resource-Management/Assignment/srv/src/main/java/com/sap/c4p/rm/assignment/simulation/CreateAssignmentForRequestedEffortDistributionSimulator.java:[22,37] package com.sap.c4p.rm.assignment.gen does not exist [ERROR] /C:/C4PRM_Repository/Repositories/Repository_For_Development/Resource-Management/Assignment/srv/src/main/java/com/sap/c4p/rm/assignment/handlers/ResourceManagerAssignmentServiceHandler.java:[28,37] package com.sap.c4p.rm.assignment.gen does not exist [ERROR] /C:/C4PRM_Repository/Repositories/Repository_For_Development/Resource-Management/Assignment/srv/src/main/java/com/sap/c4p/rm/assignment/simulation/AssignmentSimulatorFactory.java:[8,37] package com.sap.c4p.rm.assignment.gen does not exist [ERROR] /C:/C4PRM_Repository/Repositories/Repository_For_Development/Resource-Management/Assignment/srv/src/main/java/com/sap/c4p/rm/assignment/handlers/AssignmentServiceHandler.java:[34,37] package com.sap.c4p.rm.assignment.gen does not exist [ERROR] /C:/C4PRM_Repository/Repositories/Repository_For_Development/Resource-Management/Assignment/srv/src/main/java/com/sap/c4p/rm/assignment/integration/AssignmentS4Integration.java:[38,37] package com.sap.c4p.rm.assignment.gen does not exist [ERROR] /C:/C4PRM_Repository/Repositories/Repository_For_Development/Resource-Management/Assignment/srv/src/main/java/com/sap/c4p/rm/assignment/utils/AssignmentDependentEntityUpdateUtility.java:[23,37] package com.sap.c4p.rm.assignment.gen does not exist [ERROR] /C:/C4PRM_Repository/Repositories/Repository_For_Development/Resource-Management/Assignment/srv/src/main/java/com/sap/c4p/rm/assignment/integration/SupplyDestination.java:[21,37] package com.sap.c4p.rm.assignment.gen does not exist [ERROR] /C:/C4PRM_Repository/Repositories/Repository_For_Development/Resource-Management/Assignment/srv/src/main/java/com/sap/c4p/rm/assignment/handlers/RequesterAssignmentServiceHandler.java:[16,37] package com.sap.c4p.rm.assignment.gen does not exist [ERROR] /C:/C4PRM_Repository/Repositories/Repository_For_Development/Resource-Management/Assignment/srv/src/main/java/com/sap/c4p/rm/assignment/handlers/ConsultantAssignmentServiceHandler.java:[26,37] package com.sap.c4p.rm.assignment.gen does not exist [ERROR] /C:/C4PRM_Repository/Repositories/Repository_For_Development/Resource-Management/Assignment/srv/src/main/java/com/sap/c4p/rm/assignment/handlers/IntegrationMonitorActionHandler.java:[19,37] package com.sap.c4p.rm.assignment.gen does not exist
Project Details
- SDK Version: <your SAP Cloud SDK version here>4.28.0
- Link to GitHub repo:
https://github.tools.sap/Cloud4RM/Assignment/tree/master - Project type, for example:
- [X ] CAP Project
- [ ] SDK Maven Archetype
- [ ] None of the above:
- Platform:
- [X ] Cloud Foundry
- [ ] Deploy with Confidence (Cloud Foundry)
- [ ] None of the above:
Hi @Noorie123-github,
I checked your plugin configuration and I think the issue occurs because of enabling the deleteOutputDirectory parameter:
<deleteOutputDirectory>true</deleteOutputDirectory>
This option will delete the contents of the output directory before generating the client. Please remove this parameter and that should fix your issue.
Regards, Kavitha
Also in upcoming release of SAP Cloud SDK 5.12.0 we improved the deletion feature:
- [OpenAPI Generator] Setting the Maven plugin configuration property
openapi.generate.deleteOutputDirectorytotruewill no longer result in deletion of all files from theoutputDirectoryprior to generation. Instead, only theapiPackage- andapiPackage-related directories will be cleaned. This reduces the risk of deleting files unexpectedly and allows for reusing the sameoutputDirectoryfor multiple generator plugin invocations.
Since you are working with old SAP Cloud SDK version 4, for which we can't offer further support, I'm closing the issue. If Kavitha's suggestion doesn't help here are more ideas:
- Move the code generation target to a dedicated directory. It's possible in POM to add source directories.
- Don't run the generator, when the spec hasn't changed.
- You can adjust the default mvn phase in the plugin.
- You can remove the plugin from POM.
- You can move the generated code into a dedicated ~directory~ mvn module, where it doesn't overlap with your productive application code.