cloud-sdk-java icon indicating copy to clipboard operation
cloud-sdk-java copied to clipboard

Gen folder is deleted from after switching to ODATA generator using EDMX

Open Noorie123-github opened this issue 1 year ago • 1 comments

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:

Noorie123-github avatar Aug 19 '24 08:08 Noorie123-github

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

KavithaSiva avatar Aug 19 '24 09:08 KavithaSiva

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.deleteOutputDirectory to true will no longer result in deletion of all files from the outputDirectory prior to generation. Instead, only the apiPackage- and apiPackage-related directories will be cleaned. This reduces the risk of deleting files unexpectedly and allows for reusing the same outputDirectory for 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.

newtork avatar Aug 26 '24 08:08 newtork